library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
all$trt=factor(all$trt)#
male <- all[which (all$sex %in% c("Male")),]#
malep <- male[which (male$odsource %in% c("Plant material")),]#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
#
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]#
#
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))#
#
# Wind tunnel flight responses plot#
# Full colour plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt, #
  color=trt, # colour#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)#
# Wind tunnel flight responses plot#
# Black and white version#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt,#
 color=NULL, # black and white#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)#
# Logestic regression#
# Male plant#
#
# Take off#
malepT <- malep[which (malep$reachl %in% c("Take off")),]#
mod1 <- glm(actual ~ trt, data = malepT, family = "binomial")#
Anova(mod1)#
summary (glht(mod1, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
malep50 <- malep[which (malep$reachl %in% c("50 cm")),]#
mod2 <- glm(actual ~ trt, data = malep50, family = "binomial")#
Anova(mod2)#
summary (glht(mod2, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
malep7 <- malep[which (malep$reachl %in% c("7 cm")),]#
mod3 <- glm(actual ~ trt, data = malep7, family = "binomial")#
Anova(mod3)#
summary (glht(mod3, linfct=mcp(trt="Dunnett")))#
#
# Land#
#
malepL <- malep[which (malep$reachl %in% c("Land")),]#
mod4 <- glm (actual ~ trt, data = malepL, family = "binomial")#
Anova(mod4)#
summary (glht(mod4, linfct=mcp(trt="Dunnett")))#
#
#--------------------------------------------------------------------------#
# Male Headspace#
#
# Take off#
maleheT <- malehe[which (malehe$reachl %in% c("Take off")),]#
mod5 <- glm(actual ~ trt, data = maleheT, family = "binomial")#
Anova(mod5)#
summary (glht(mod5, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
malehe50 <- malehe[which (malehe$reachl %in% c("50 cm")),]#
mod6 <- glm(actual ~ trt, data = malehe50, family = "binomial")#
Anova(mod6)#
summary (glht(mod6, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
malehe7 <- malehe[which (malehe$reachl %in% c("7 cm")),]#
mod7 <- glm(actual ~ trt, data = malehe7, family = "binomial")#
Anova(mod7)#
summary (glht(mod7, linfct=mcp(trt="Dunnett")))#
#
# Land#
maleheL <- malehe[which (malehe$reachl %in% c("Land")),]#
mod8 <- glm (actual ~ trt, data = maleheL, family = "binomial")#
Anova(mod8)#
summary (glht(mod8, linfct=mcp(trt="Dunnett")))#
#
#----------------------------------------------------------------------------------#
# Mated female plant#
#
# Take off#
femalepT <- femalep[which (femalep$reachl %in% c("Take off")),]#
mod9 <- glm(actual ~ trt, data = femalepT, family = "binomial")#
Anova(mod9)#
summary (glht(mod9, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
femalep50 <- femalep[which (femalep$reachl %in% c("50 cm")),]#
mod10 <- glm(actual ~ trt, data = femalep50, family = "binomial")#
Anova(mod10)#
summary (glht(mod10, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
femalep7 <- femalep[which (femalep$reachl %in% c("7 cm")),]#
mod11 <- glm(actual ~ trt, data = femalep7, family = "binomial")#
Anova(mod11)#
summary (glht(mod11, linfct=mcp(trt="Dunnett")))#
#
# Land#
femalepL <- femalep[which (femalep$reachl %in% c("Land")),]#
mod12 <- glm (actual ~ trt, data = femalepL, family = "binomial")#
#plot(density(mod12$residuals))#
Anova(mod12)#
summary (glht(mod12, linfct=mcp(trt="Dunnett")))#
#
#----------------------------------------------------------------------------------------#
# Mated female Headspace#
# Take off#
femaleheT <- femalehe[which (femalehe$reachl %in% c("Take off")),]#
mod13 <- glm(actual ~ trt, data = femaleheT, family = "binomial")#
Anova(mod13)#
summary (glht(mod13, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
femalehe50 <- femalehe[which (femalehe$reachl %in% c("50 cm")),]#
mod14 <- glm(actual ~ trt, data = femalehe50, family = "binomial")#
Anova(mod14)#
summary (glht(mod14, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
femalehe7 <- femalehe[which (femalehe$reachl %in% c("7 cm")),]#
mod15 <- glm(actual ~ trt, data = femalehe7, family = "binomial")#
Anova(mod15)#
summary (glht(mod15, linfct=mcp(trt="Dunnett")))#
#
# Land#
#
femaleheL <- femalehe[which (femalehe$reachl %in% c("Land")),]#
mod16 <- glm (actual ~ trt, data = femaleheL, family = "binomial")#
Anova(mod16)#
summary (glht(mod16, linfct=mcp(trt="Dunnett")))#
#-------------------------------------------------------------------------------------------#
# virgin female plant#
# Take off#
vfemalepT <- vfemalep[which (vfemalep$reachl %in% c("Take off")),]#
mod17 <- glm(actual ~ trt, data = vfemalepT, family = "binomial")#
Anova(mod17)#
summary (glht(mod17, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
vfemalep50 <- vfemalep[which (vfemalep$reachl %in% c("50 cm")),]#
mod18 <- glm(actual ~ trt, data = vfemalep50, family = "binomial")#
Anova(mod18)#
summary (glht(mod18, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
vfemalep7 <- vfemalep[which (vfemalep$reachl %in% c("7 cm")),]#
mod19 <- glm(actual ~ trt, data = vfemalep7, family = "binomial")#
Anova(mod19)#
summary (glht(mod19, linfct=mcp(trt="Dunnett")))#
#
# Land#
vfemalepL <- vfemalep[which (vfemalep$reachl %in% c("Land")),]#
mod20 <- glm (actual ~ trt, data = vfemalepL, family = "binomial")#
Anova(mod20)#
summary (glht(mod20, linfct=mcp(trt="Dunnett")))#
#-----------------------------------------------------------------------------------------------#
# virgin female Headspace#
# Take off#
vfemaleheT <- vfemalehe[which (vfemalehe$reachl %in% c("Take off")),]#
mod21 <- glm(actual ~ trt, data = vfemaleheT, family = "binomial")#
Anova(mod21)#
summary (glht(mod21, linfct=mcp(trt="Dunnett")))#
#
# 50 cm#
vfemalehe50 <- vfemalehe[which (vfemalehe$reachl %in% c("50 cm")),]#
mod22 <- glm(actual ~ trt, data = vfemalehe50, family = "binomial")#
Anova(mod22)#
summary (glht(mod22, linfct=mcp(trt="Dunnett")))#
#
# 7 cm#
vfemalehe7 <- vfemalehe[which (vfemalehe$reachl %in% c("7 cm")),]#
mod23 <- glm(actual ~ trt, data = vfemalehe7, family = "binomial")#
Anova(mod23)#
summary (glht(mod23, linfct=mcp(trt="Dunnett")))#
#
# Land#
#
vfemaleheL <- vfemalehe[which (vfemalehe$reachl %in% c("Land")),]#
mod24 <- glm (actual ~ trt, data = vfemaleheL, family = "binomial")#
Anova(mod24)#
summary (glht(mod24, linfct=mcp(trt="Dunnett")))#
#////////////////////////////////////////////////////////////////////////////////////////////////////#
# Kaplan_Meier #
# Male Plant  #
  # Pistachio#
malepp<-malep[which(malep$trt %in% c("Pistachio","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepp)#
ggsurvplot(km_fit, data = malepp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom#
malepcp<-malep[which(malep$trt %in% c("Cracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepcp)#
ggsurvplot(km_fit, data = malepcp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Uncracked pom#
malepup<-malep[which(malep$trt %in% c("Uncracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepup)#
ggsurvplot(km_fit, data = malepup, pval = TRUE, xlab="", ylab= "Reached")#
#Unripe pom #
malepurp<-malep[which(malep$trt %in% c("Unripe pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepurp)#
ggsurvplot(km_fit, data = malepurp, pval = TRUE, xlab="", ylab= "Reached")#
#
#Flower pom #
malepf<-malep[which(malep$trt %in% c("Flower pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepf)#
ggsurvplot(km_fit, data = malepf, pval = TRUE, xlab="", ylab= "Reached")#
#
#-------------------------------------#
# Male Headspace extract  #
#
# Pistachio HE#
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehep)#
ggsurvplot(km_fit, data = malehep, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom HE#
malehecp<-malehe[which(malehe$trt %in% c("Cracked pom HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehecp)#
ggsurvplot(km_fit, data = malehecp, pval = TRUE, xlab="", ylab= "Reached")#
#
#-----------------------------------------------------#
  # Mated female Plant  #
  # Pistachio#
femalepp<-femalep[which(femalep$trt %in% c("Pistachio","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepp)#
ggsurvplot(km_fit, data = femalepp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom#
femalepcp<-femalep[which(femalep$trt %in% c("Cracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepcp)#
ggsurvplot(km_fit, data = femalepcp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Uncracked pom#
femalepup<-femalep[which(femalep$trt %in% c("Uncracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepup)#
ggsurvplot(km_fit, data = femalepup, pval = TRUE, xlab="", ylab= "Reached")#
#
#Unripe pom #
femalepurp<-femalep[which(femalep$trt %in% c("Unripe pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepurp)#
ggsurvplot(km_fit, data = femalepurp, pval = TRUE, xlab="", ylab= "Reached")#
#
#Flower pom #
femalepf<-femalep[which(femalep$trt %in% c("Flower pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepf)#
ggsurvplot(km_fit, data = femalepf, pval = TRUE, xlab="", ylab= "Reached")#
#
#-------------------------------------#
  # Mated female Headspace extract  #
  # Pistachio HE#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom HE#
femalehecp<-femalehe[which(femalehe$trt %in% c("Cracked pom HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehecp)#
ggsurvplot(km_fit, data = femalehecp, pval = TRUE, xlab="", ylab= "Reached")#
#
#-----------------------------------------------------#
# Virgin female Plant  #
# Pistachio#
# vfemalepp<-vfemalep[which(vfemalep$trt %in% c("Pistachio","Blank")),]#
# km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepp)#
# ggsurvplot(km_fit, data = vfemalepp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom#
vfemalepcp<-vfemalep[which(vfemalep$trt %in% c("Cracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepcp)#
ggsurvplot(km_fit, data = vfemalepcp, pval = TRUE, xlab="", ylab= "Reached")#
#
# Uncracked pom#
vfemalepup<-vfemalep[which(vfemalep$trt %in% c("Uncracked pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepup)#
ggsurvplot(km_fit, data = vfemalepup, pval = TRUE, xlab="", ylab= "Reached")#
#
#Unripe pom #
vfemalepurp<-vfemalep[which(vfemalep$trt %in% c("Unripe pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepurp)#
ggsurvplot(km_fit, data = vfemalepurp, pval = TRUE, xlab="", ylab= "Reached")#
#
#Flower pom #
vfemalepf<-vfemalep[which(vfemalep$trt %in% c("Flower pom","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepf)#
ggsurvplot(km_fit, data = vfemalepf, pval = TRUE, xlab="", ylab= "Reached")#
#
#-------------------------------------#
  # vfemale Headspace extract  #
  # Pistachio HE#
vfemalehep<-vfemalehe[which(vfemalehe$trt %in% c("Pistachio HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehep)#
ggsurvplot(km_fit, data = vfemalehep, pval = TRUE, xlab="", ylab= "Reached")#
#
# Cracked pom HE#
vfemalehecp<-vfemalehe[which(vfemalehe$trt %in% c("Cracked pom HE","Blank")),]#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehecp)#
ggsurvplot(km_fit, data = vfemalehecp, pval = TRUE, xlab="", ylab= "Reached")#
#
#-----------------------------------------------------#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Relative amount of Beta-caryophyllene in the plant materials#
#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
car$trt=as.factor(car$trt)#
car$trt <- factor(car$trt , levels=c("Unripe pom","Flower pom", "Uncracked pom","Cracked pom","Pistachio"))#
#
Glm <- glm(rel~trt, data=car, family = Gamma)#
Anova(Glm)#
plot(density(Glm$residuals))#
#
p <- glht(Glm, linfct = mcp(trt = "Tukey"))#
summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)#
#
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)#
#
# add significance letters#
  x=c(1:8)  #
  y=c(2.46,1.38, 0.53, 0.47, 0.38)#
  text(x,y, c("a","b","c","c","d"), cex=1.0)#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Ovipostion plot#
#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
#
# Scatter plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
par(xpd=TRUE)#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot(Ovi, aes(x=cons, y =tot))+ #
  geom_jitter(position=position_jitter(0.08)) +#
  labs(y="Number of eggs", x="")+ #
  theme(text = element_text(size=15))+#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+#
  stat_summary (fun=mean, size=1.0, geom="line") +#
  stat_summary (fun=mean, size=3, geom="point")+#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+#
  facet_grid(.~trt)#
# add significance letters#
  x=c(1:16)  #
  y=c(10.9)#
  x= c(1.13, 1.73, 2.33, 2.95, 3.55, 4.15, 4.75, 5.35,     6.2, 6.8, 7.4, 8.0, 8.65, 9.15, 9.85, 10.45)#
  text(x,y, c("b","b","a","a","a", "b","c","d","BC","AB","AB","A","AB","C", "AB","AB"), cex=1.0)#
#
# add N #
  x= c(0.6, 1.05, 1.63, 2.2, 2.85, 3.45, 4.05, 4.70, 5.30,     6.10, 6.70, 7.30, 7.90, 8.55, 9.05, 9.75, 10.35)#
  y=c(-0.9)#
  text(x,y, c( "N:", "48","10","9","10","21", "9","20","12","48","9","10","8","10","8", "14","6"), cex=1.0)#
# Model analysis#
caryo <- Ovi [which (Ovi$trt %in% c("Hexane (control)", "Beta-caryophyllene")),]#
cis3 <- Ovi [which (Ovi$trt %in% c("Hexane (control)", "Cis-3-hexen-1-ol")),]#
#
caryo$consl=as.factor(caryo$consl)#
cis3$consl=as.factor(cis3$consl)#
#
modc <- glm(data=caryo, tot~consl+date , family = poisson) #
densityPlot(modc$residuals)#
Anova (modc)#
summary (glht(modc, linfct=mcp(consl="Dunnett")))#
#
p <- glht(modc, linfct = mcp(consl = "Tukey"))#
# summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)#
#
modcis <- glm(data=cis3, tot~consl + date, family = poisson) #
Anova (modcis)#
densityPlot(modcis$residuals)#
summary (glht(modcis, linfct=mcp(consl="Dunnett")))#
#
p <- glht(modcis, linfct = mcp(consl = "Tukey"))#
# summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)#
#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
#function kovats: Calculate the kovats index, using the linear temperature programming formula (8) taken from#
# Dool,H vand en and Kratz, P.D. (1963) A generalization of the retention index including linear temperature programmed Gas-Liquid#
# partition chromatography. J. Chromatography 11: 463-471.#
#
# I=100*(X-Mn)/(Mn+1 - Mn)+ 100n#
#
# Where X is the rentention time of the peak of interest,Rn and Rnplus1 the  retention times of the alkens eluting directly #
# before and after that peak with n and n+1 the number of carbom atoms in these alkenes#
#
kovats=function(X,Rn, Rnplus1, n) {#
	RI= 100*(X-Rn)/(Rnplus1 - Rn)+ 100*n#
	return (round(RI, 0))#
}#
#
#Results from the experiment:#
X=34.08#
Rn = 32.63#
Rnplus1 = 38.68#
n=14#
#
RI=kovats(X, Rn, Rnplus1, n)#
RI # #1424,  MS suggest Caryophellene#
#
# compare this result with known retetion indices for Caryophellene from the literature#
# retrieved from https://pubchem.ncbi.nlm.nih.gov/compound/beta-caryophyllene#section=Kovats-Retention-Index, Oktober 13, 2020#
#Source: NIST Mass Spectrometry Data Center #Record Name: Caryophyllene#
#URL: http://www.nist.gov/srd/nist1a.cfm#
#
standard_nonpolar=c(1423, 1420, 1420, 1419, 1423, 1418, 1421, 1432, 1457, 1419, 1419, 1420, 1427, 1419, 1419, 1423, 1419, 1418, 1411, 1430, 1431, 1415, 1418, 1417, 1420, 1418, 1414, 1416, 1425.6, 1398, 1417, 1418, 1418, 1418, 1418, 1440, 1413, 1413, 1413, 1413, 1413, 1440, 1418, 1457, 1415, 1420, 1467, 1418, 1420, 1419, 1421, 1419, 1417, 1418, 1438, 1418, 1411, 1426, 1467, 1390, 1412, 1430, 1419, 1422, 1414, 1427, 1413, 1419, 1419, 1414, 1417, 1437.2, 1442, 1410, 1423, 1425, 1421, 1420, 1428, 1416, 1420, 1420, 1419, 1420, 1412, 1434, 1418, 1418, 1419, 1417, 1412, 1407, 1404, 1417.6, 1426, 1431.8, 1417, 1416, 1418, 1432, 1435, 1428, 1420, 1419, 1418, 1422, 1420, 1420, 1420, 1419, 1420, 1413, 1417, 1425, 1425, 1418, 1418, 1417, 1425, 1428, 1441, 1406, 1420, 1419, 1420, 1422, 1418, 1424, 1397, 1408, 1427, 1429, 1426, 1430, 1422, 1419, 1419, 1420, 1420, 1419, 1419, 1420, 1418, 1419, 1419, 1419, 1407, 1428, 1420, 1420, 1420, 1420, 1419, 1420, 1418, 1439, 1417, 1418, 1419, 1415, 1420, 1418, 1423, 1415, 1420, 1418
, 1418, 1414, 1418, 1420, 1423, 1421, 1418, 1418, 1419, 1419, 1418, 1404, 1417, 1421, 1418, 1418, 1419, 1420, 1420, 1418, 1418, 1418, 1416, 1418, 1412, 1409, 1410, 1415, 1418, 1416, 1390, 1431, 1418, 1426, 1417, 1416, 1423, 1418, 1411, 1418, 1418, 1418, 1421, 1421, 1414, 1418, 1420, 1419, 1420, 1427, 1418, 1401.3, 1403.15, 1439, 1419, 1423, 1414, 1419, 1425, 1415, 1415, 1414, 1417, 1417, 1417, 1418, 1428, 1418, 1415, 1415, 1404, 1404, 1428, 1418, 1423, 1427, 1420, 1418, 1420, 1400, 1419, 1427, 1440, 1418, 1415, 1417, 1444, 1420, 1422, 1419, 1414, 1451, 1419, 1418, 1423, 1423, 1419, 1420, 1414, 1418, 1451, 1417, 1429.6, 1419, 1427, 1416, 1420, 1419, 1418, 1418, 1409, 1431, 1410, 1418, 1417, 1419, 1417, 1431, 1428, 1446, 1399, 1419, 1420, 1394, 1395, 1408, 1418, 1420, 1451, 1420, 1418, 1420, 1422, 1411, 1415, 1419, 1424, 1418, 1425, 1418, 1418, 1418, 1418, 1418, 1455, 1417, 1420, 1418, 1418, 1419, 1435, 1418, 1424, 1420, 1418, 1455, 1418, 1399, 1417, 1419, 1420, 1418, 1390, 1396, 1417, 1418, 1421, 1405, 1390,
1419, 1412, 1412, 1413, 1417, 1417, 1423, 1442, 1427, 1417, 1419, 1411, 1438, 1419, 1424, 1434, 1419, 1418, 1418, 1413, 1413, 1413, 1419, 1427, 1427, 1424, 1438, 1419, 1418, 1420, 1414, 1418, 1418, 1419, 1458, 1417, 1431, 1418, 1419, 1419, 1420, 1424, 1429, 1430, 1421, 1415, 1414, 1430, 1432, 1430, 1431, 1420, 1462, 1419, 1393, 1408, 1418, 1424, 1422, 1416, 1423, 1419, 1419, 1428, 1420, 1430, 1427, 1420, 1411, 1420, 1421, 1427, 1428, 1424, 1420, 1418, 1420, 1419, 1416, 1410, 1420, 1451, 1416, 1429, 1442, 1427, 1411, 1418, 1459, 1435, 1439, 1436, 1411, 1411, 1419, 1440, 1411, 1416, 1439, 1416, 1418, 1426, 1419, 1425, 1414, 1434, 1415, 1422, 1423, 1424, 1426, 1438, 1426, 1429, 1429, 1418, 1413, 1421, 1410, 1414, 1420, 1425, 1419, 1427, 1422, 1420, 1419, 1432, 1432, 1418, 1416, 1426, 1465, 1467, 1427, 1400, 1407, 1418, 1418, 1412, 1418, 1419, 1403, 1403, 1403, 1425, 1418, 1419, 1418, 1424, 1424, 1397, 1425, 1423, 1417, 1433, 1419, 1425, 1449, 1422, 1436, 1436, 1420, 1420, 1421, 1425, 1420, 1419, 1428, 1418, 1
458, 1427, 1423, 1412, 1414, 1420, 1422, 1419, 1433, 1415, 1410, 1399, 1401, 1455, 1414, 1419, 1436, 1416, 1418, 1421, 1417, 1419, 1418, 1418, 1419, 1418, 1411, 1455, 1414, 1448, 1424, 1418, 1412, 1415, 1415, 1447, 1422, 1434, 1414, 1432, 1396, 1421, 1406, 1418, 1458, 1415, 1390, 1430, 1422, 1418, 1412, 1413, 1419, 1422, 1389, 1419, 1421, 1465, 1419, 1409, 1420, 1427, 1428, 1419, 1419, 1468, 1468, 1413, 1419, 1422, 1419, 1420, 1396, 1418, 1424, 1419, 1419, 1414, 1418, 1424, 1419, 1403, 1412, 1420, 1414.5, 1419, 1408, 1414, 1417, 1420, 1430, 1402, 1417, 1418, 1415, 1418, 1412, 1421, 1417, 1418, 1418, 1416, 1414, 1418, 1422, 1415, 1414, 1420, 1420, 1421, 1422, 1448, 1417, 1418, 1418, 1412, 1416, 1419, 1414, 1427, 1428, 1422, 1424, 1424, 1418, 1415, 1415, 1419, 1418, 1418, 1399, 1421, 1419, 1419, 1421, 1425, 1418, 1425, 1427, 1423, 1418, 1418, 1418, 1418, 1420, 1423, 1419, 1430, 1415, 1417, 1441, 1419, 1420, 1402, 1417, 1419, 1420, 1420, 1420, 1413, 1413, 1418, 1415, 1414, 1431, 1418, 1420, 1420, 1421, 1418, 1
412, 1419, 1458, 1413, 1403, 1420, 1414, 1407, 1430, 1418, 1421, 1427, 1416, 1405, 1395, 1418, 1417, 1418, 1419, 1420, 1417, 1419, 1454, 1421, 1418, 1450, 1414, 1411, 1420, 1422, 1416, 1413, 1418, 1426, 1428, 1418, 1413, 1418, 1421, 1419, 1425, 1425, 1414, 1392, 1419, 1419, 1419, 1421, 1418, 1426, 1415, 1418, 1444, 1426, 1431, 1419, 1406, 1423, 1418, 1434, 1416, 1416, 1421, 1418, 1414, 1418, 1418, 1409, 1409, 1415, 1420, 1417, 1419, 1423, 1417, 1453, 1418, 1420, 1410, 1403, 1421, 1418, 1413, 1398, 1404, 1418, 1418, 1418, 1419, 1418, 1441, 1419, 1426, 1415, 1418, 1419, 1409, 1425, 1418, 1400, 1418, 1414, 1414, 1415, 1415, 1416, 1394, 1425, 1412, 1419, 1413, 1413, 1418, 1418, 1421, 1419, 1412, 1419, 1420, 1418, 1415, 1414, 1431, 1420, 1419, 1406, 1414, 1419, 1419, 1418, 1443, 1424, 1437, 1419, 1416, 1418, 1431, 1442, 1431, 1433, 1418, 1391, 1421, 1420.9, 1419, 1421, 1426, 1422, 1418, 1432, 1437, 1419, 1427, 1415, 1426, 1419, 1420, 1406, 1410, 1411, 1425, 1418, 1418, 1418, 1418, 1417.6, 1413, 1423.3, 1418, 142
1, 1418, 1406, 1417, 1419, 1425, 1418, 1416, 1455, 1414, 1420, 1420, 1424, 1424, 1425, 1418, 1414, 1419, 1418.5, 1425, 1420, 1419, 1428, 1418, 1411, 1419, 1422, 1422, 1417, 1426, 1418, 1419, 1424, 1413, 1418, 1438.8, 1418, 1418, 1418, 1426, 1405, 1416, 1425, 1414, 1414, 1433, 1412, 1415, 1419, 1420, 1418, 1418, 1419, 1419, 1425, 1425, 1428, 1428, 1430, 1406, 1423, 1425, 1418, 1418, 1418, 1418, 1422, 1410, 1420, 1414, 1424, 1404, 1419, 1420, 1418, 1414, 1421, 1384, 1420, 1415, 1418, 1416, 1428, 1431, 1418, 1417, 1408, 1420, 1417, 1454, 1430, 1434, 1422.7, 1438.2, 1422, 1411, 1417, 1419, 1427, 1419, 1425, 1418, 1437, 1418, 1418, 1451, 1419, 1418, 1428, 1419, 1422, 1424, 1420, 1420, 1416, 1428, 1427, 1400, 1419, 1418, 1416.1, 1418.3, 1419, 1457, 1432, 1429, 1423, 1425, 1426, 1437, 1410, 1425.7, 1429, 1422, 1435, 1430, 1435, 1444, 1444, 1468, 1468, 1418, 1421, 1419, 1420, 1420, 1420, 1418, 1419, 1416, 1415, 1423, 1424, 1411, 1418, 1419, 1419, 1433, 1411, 1412, 1416, 1455, 1413, 1419, 1416, 1421)#
#
semni_standard_nonpolar=c(1424, 1421, 1420, 1447, 1418, 1419, 1417, 1414, 1419, 1419, 1403, 1409, 1427, 1420, 1419, 1408, 1412, 1421, 1419, 1419, 1412, 1408, 1409, 1410, 1407, 1410, 1409, 1424, 1409, 1418, 1408, 1405, 1396, 1399, 1424, 1391, 1406, 1419, 1419, 1419, 1420, 1409, 1407, 1428, 1399, 1420, 1391.8, 1404.3, 1417.1, 1408, 1408, 1418, 1426, 1398, 1420, 1417, 1417, 1400, 1423, 1408, 1419, 1400, 1391, 1410, 1400, 1414, 1402.9, 1409, 1418, 1405, 1405, 1420, 1411, 1406, 1410, 1410, 1421, 1415.1, 1418, 1423, 1437, 1418.3, 1420, 1420, 1410, 1410, 1421, 1424, 1419, 1423, 1421, 1420, 1420, 1401, 1430, 1419, 1425, 1420, 1420, 1420, 1420, 1426, 1403, 1435, 1427, 1421, 1397, 1406, 1426, 1426, 1425, 1422, 1400, 1420, 1398, 1431, 1431, 1429, 1429, 1422, 1439, 1440, 1445, 1448, 1448, 1449, 1449, 1450, 1451, 1451, 1453, 1455, 1457, 1459, 1438, 1425, 1427, 1416, 1438, 1414, 1408.7, 1414.8, 1415.3, 1430.2, 1447.9, 1427.5, 1435.06, 1427, 1403, 1414, 1427, 1422, 1428, 1420, 1430, 1432, 1426, 1413, 1428, 1392.14, 1400,
1407.76, 1412.51, 1419.57, 1426.69, 1433.93, 1441.31, 1449.01, 1456.63, 1464.5, 1417, 1432, 1421, 1423, 1418, 1425, 1423, 1423, 1428, 1425, 1425, 1411, 1428, 1419, 1425, 1420, 1411, 1422, 1428, 1418, 1420, 1422, 1422, 1422, 1412, 1433, 1421, 1420, 1405, 1420, 1408, 1419, 1417, 1420, 1407, 1414, 1422, 1422, 1405, 1414, 1429, 1424, 1428, 1417, 1422, 1422, 1418, 1418, 1425, 1432.6, 1425, 1403, 1426, 1410, 1415, 1403, 1426, 1424, 1420, 1449, 1456, 1424, 1440, 1408, 1411, 1430, 1440, 1426, 1427, 1434, 1442, 1449, 1427, 1434, 1442, 1449, 1440, 1442, 1446, 1446, 1436, 1417.5, 1418, 1422, 1422, 1424, 1424, 1417, 1418, 1421, 1423, 1435, 1426, 1467, 1418, 1420, 1420, 1424, 1438, 1409, 1424, 1422, 1406, 1427, 1418, 1415, 1423, 1419, 1419, 1425, 1426, 1427, 1436, 1425, 1461, 1415, 1414, 1414, 1421, 1424, 1384, 1414, 1414, 1419, 1413, 1419, 1419, 1421, 1424, 1424, 1434, 1414, 1427, 1414, 1421, 1418, 1417, 1400, 1418, 1410, 1410, 1403, 1417, 1423, 1423, 1427, 1414, 1429, 1414, 1417, 1421, 1415, 1420, 1413, 1416, 1423, 14
21, 1421, 1408, 1412, 1424, 1415, 1414, 1413, 1428, 1428, 1429, 1419, 1421, 1412, 1415, 1415, 1404, 1419, 1421, 1408, 1422, 1397, 1430, 1423, 1417, 1418, 1418, 1416, 1423, 1419, 1423, 1422, 1429, 1439, 1414, 1412, 1401, 1412, 1398, 1414, 1420, 1416, 1424, 1429, 1414, 1422, 1414, 1423, 1433, 1435, 1398, 1402, 1418, 1423, 1423, 1418, 1410, 1410, 1419, 1419, 1398, 1430, 1427, 1424, 1418, 1414, 1400, 1423, 1412, 1419, 1421, 1416, 1426, 1416, 1408, 1424, 1419, 1420, 1422, 1422, 1414, 1419, 1418, 1419, 1418, 1409, 1418, 1418, 1398, 1429, 1429, 1415, 1415, 1422, 1415, 1412, 1414, 1420, 1419, 1402, 1429, 1428, 1414, 1414, 1417, 1417, 1423, 1413, 1430, 1455.4, 1391.8, 1420, 1411, 1423, 1405, 1414, 1415, 1419, 1412, 1406, 1421, 1414, 1420, 1423, 1423, 1409, 1413, 1416, 1416, 1415, 1401, 1423, 1430, 1421.7, 1429.4, 1415, 1422, 1414, 1412, 1424, 1408, 1422, 1391, 1423, 1420, 1428, 1428, 1419, 1414, 1423, 1409, 1413, 1411, 1414, 1419, 1400, 1427, 1411, 1419, 1414, 1422, 1417, 1427, 1428, 1420, 1403, 1410, 1415, 1411, 14
11, 1403, 1418, 1394, 1422, 1425, 1425, 1405, 1434, 1409, 1418.5, 1414, 1440, 1418, 1460, 1418, 1398, 1423, 1429, 1416, 1420, 1414, 1420, 1411, 1423, 1431, 1396, 1396, 1397, 1397, 1417, 1422, 1423, 1421, 1418, 1429, 1419, 1401, 1420, 1397, 1401, 1407, 1404, 1414, 1428, 1422, 1432.1, 1420, 1422, 1414, 1424, 1423, 1424, 1417, 1423, 1427, 1415, 1418, 1414, 1405, 1403, 1419, 1419, 1414, 1435, 1421, 1418, 1420, 1423, 1437, 1414, 1414, 1396, 1397, 1437, 1429, 1414, 1420, 1420, 1419, 1419, 1411, 1414, 1433, 1410, 1420, 1408, 1411, 1420, 1422, 1423, 1425, 1419, 1411, 1416, 1417, 1415, 1415, 1416, 1425, 1427, 1406, 1417, 1424, 1424, 1424, 1424, 1415, 1417, 1428, 1429, 1421, 1423, 1423, 1409, 1408, 1409, 1414, 1414, 1415, 1420, 1412, 1422, 1422, 1397.4, 1417.4, 1417.4, 1418, 1418.5, 1414, 1415, 1423, 1415, 1415, 1412, 1414, 1415, 1422, 1422, 1422, 1410, 1452, 1414, 1410, 1413, 1428, 1445, 1410, 1414, 1434, 1435, 1416, 1414, 1413, 1412, 1413, 1413, 1410, 1442, 1450, 1417, 1411, 1414, 1425, 1428)#
#
all_nonpolar=c(standard_nonpolar,semni_standard_nonpolar)#
summary(all_nonpolar)#
sd(all_nonpolar)#
#
histdata = hist(all_nonpolar)#
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)#
#
# Read the raw data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
str(all)
table(all.odsource)
table(all$odsource)
table(all$trt)
as.data.frame(table(all$sex))
as.data.frame(table(all$actual))
as.data.frame(table(all$reachl))
as.data.frame(table(all$reach))
as.data.frame(table(all$stat))
as.data.frame(table(all$rch))
as.data.frame(table(all$actual.original))
all$trt=factor(all$trt)#
male <- all[which (all$sex %in% c("Male")),]#
malep <- male[which (male$odsource %in% c("Plant material")),]#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
#
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]#
#
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))
# Wind tunnel flight responses plot#
# Full colour plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt, #
  color=trt, # colour#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
# Wind tunnel flight responses plot#
# Black and white version#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt,#
 color=NULL, # black and white#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)
# Wind tunnel flight responses plot#
# Black and white version#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt,#
 color=NULL, # black and white#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
# read data and set factors#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
car$trt=as.factor(car$trt)#
car$trt <- factor(car$trt , levels=c("Unripe pom","Flower pom", "Uncracked pom","Cracked pom","Pistachio"))
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)
# add significance letters#
  x=c(1:8)  #
  y=c(2.46,1.38, 0.53, 0.47, 0.38)#
  text(x,y, c("a","b","c","c","d"), cex=1.0)
# read data#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
# Scatter plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
par(xpd=TRUE)#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot(Ovi, aes(x=cons, y =tot))+ #
  geom_jitter(position=position_jitter(0.08)) +#
  labs(y="Number of eggs", x="")+ #
  theme(text = element_text(size=15))+#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+#
  stat_summary (fun=mean, size=1.0, geom="line") +#
  stat_summary (fun=mean, size=3, geom="point")+#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+#
  facet_grid(.~trt)#
# add significance letters#
  x=c(1:16)  #
  y=c(10.9)#
  x= c(1.13, 1.73, 2.33, 2.95, 3.55, 4.15, 4.75, 5.35,     6.2, 6.8, 7.4, 8.0, 8.65, 9.15, 9.85, 10.45)#
  text(x,y, c("b","b","a","a","a", "b","c","d","BC","AB","AB","A","AB","C", "AB","AB"), cex=1.0)#
#
# add N #
  x= c(0.6, 1.05, 1.63, 2.2, 2.85, 3.45, 4.05, 4.70, 5.30,     6.10, 6.70, 7.30, 7.90, 8.55, 9.05, 9.75, 10.35)#
  y=c(-0.9)#
  text(x,y, c( "N:", "48","10","9","10","21", "9","20","12","48","9","10","8","10","8", "14","6"), cex=1.0)
# Scatter plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
par(xpd=TRUE)#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot(Ovi, aes(x=cons, y =tot))+ #
  geom_jitter(position=position_jitter(0.08)) +#
  labs(y="Number of eggs", x="")+ #
  theme(text = element_text(size=15))+#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+#
  stat_summary (fun=mean, size=1.0, geom="line") +#
  stat_summary (fun=mean, size=3, geom="point")+#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+#
  facet_grid(.~trt)
# add significance letters#
  x=c(1:16)  #
  y=c(10.9)#
  x= c(1.13, 1.73, 2.33, 2.95, 3.55, 4.15, 4.75, 5.35,     6.2, 6.8, 7.4, 8.0, 8.65, 9.15, 9.85, 10.45)#
  text(x,y, c("b","b","a","a","a", "b","c","d","BC","AB","AB","A","AB","C", "AB","AB"), cex=1.0)#
#
# add N #
  x= c(0.6, 1.05, 1.63, 2.2, 2.85, 3.45, 4.05, 4.70, 5.30,     6.10, 6.70, 7.30, 7.90, 8.55, 9.05, 9.75, 10.35)#
  y=c(-0.9)#
  text(x,y, c( "N:", "48","10","9","10","21", "9","20","12","48","9","10","8","10","8", "14","6"), cex=1.0)
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
#function kovats: Calculate the kovats index, using the linear temperature programming formula (8) taken from#
# Dool,H vand en and Kratz, P.D. (1963) A generalization of the retention index including linear temperature programmed Gas-Liquid#
# partition chromatography. J. Chromatography 11: 463-471.#
#
# I=100*(X-Mn)/(Mn+1 - Mn)+ 100n#
#
# Where X is the rentention time of the peak of interest,Rn and Rnplus1 the  retention times of the alkens eluting directly #
# before and after that peak with n and n+1 the number of carbom atoms in these alkenes#
#
kovats=function(X,Rn, Rnplus1, n) {#
	RI= 100*(X-Rn)/(Rnplus1 - Rn)+ 100*n#
	return (round(RI, 0))#
}#
#
#Results from the experiment:#
X=34.08#
Rn = 32.63#
Rnplus1 = 38.68#
n=14 #compound falls between C14 and C15#
#
RI=kovats(X, Rn, Rnplus1, n)#
RI # #1424,  MS suggest Caryophellene#
#
# compare this result with known retetion indices for Caryophellene from the literature#
# retrieved from https://pubchem.ncbi.nlm.nih.gov/compound/beta-caryophyllene#section=Kovats-Retention-Index, Oktober 13, 2020#
#Source: NIST Mass Spectrometry Data Center #Record Name: Caryophyllene#
#URL: http://www.nist.gov/srd/nist1a.cfm#
#
standard_nonpolar=c(1423, 1420, 1420, 1419, 1423, 1418, 1421, 1432, 1457, 1419, 1419, 1420, 1427, 1419, 1419, 1423, 1419, 1418, 1411, 1430, 1431, 1415, 1418, 1417, 1420, 1418, 1414, 1416, 1425.6, 1398, 1417, 1418, 1418, 1418, 1418, 1440, 1413, 1413, 1413, 1413, 1413, 1440, 1418, 1457, 1415, 1420, 1467, 1418, 1420, 1419, 1421, 1419, 1417, 1418, 1438, 1418, 1411, 1426, 1467, 1390, 1412, 1430, 1419, 1422, 1414, 1427, 1413, 1419, 1419, 1414, 1417, 1437.2, 1442, 1410, 1423, 1425, 1421, 1420, 1428, 1416, 1420, 1420, 1419, 1420, 1412, 1434, 1418, 1418, 1419, 1417, 1412, 1407, 1404, 1417.6, 1426, 1431.8, 1417, 1416, 1418, 1432, 1435, 1428, 1420, 1419, 1418, 1422, 1420, 1420, 1420, 1419, 1420, 1413, 1417, 1425, 1425, 1418, 1418, 1417, 1425, 1428, 1441, 1406, 1420, 1419, 1420, 1422, 1418, 1424, 1397, 1408, 1427, 1429, 1426, 1430, 1422, 1419, 1419, 1420, 1420, 1419, 1419, 1420, 1418, 1419, 1419, 1419, 1407, 1428, 1420, 1420, 1420, 1420, 1419, 1420, 1418, 1439, 1417, 1418, 1419, 1415, 1420, 1418, 1423, 1415, 1420, 1418
, 1418, 1414, 1418, 1420, 1423, 1421, 1418, 1418, 1419, 1419, 1418, 1404, 1417, 1421, 1418, 1418, 1419, 1420, 1420, 1418, 1418, 1418, 1416, 1418, 1412, 1409, 1410, 1415, 1418, 1416, 1390, 1431, 1418, 1426, 1417, 1416, 1423, 1418, 1411, 1418, 1418, 1418, 1421, 1421, 1414, 1418, 1420, 1419, 1420, 1427, 1418, 1401.3, 1403.15, 1439, 1419, 1423, 1414, 1419, 1425, 1415, 1415, 1414, 1417, 1417, 1417, 1418, 1428, 1418, 1415, 1415, 1404, 1404, 1428, 1418, 1423, 1427, 1420, 1418, 1420, 1400, 1419, 1427, 1440, 1418, 1415, 1417, 1444, 1420, 1422, 1419, 1414, 1451, 1419, 1418, 1423, 1423, 1419, 1420, 1414, 1418, 1451, 1417, 1429.6, 1419, 1427, 1416, 1420, 1419, 1418, 1418, 1409, 1431, 1410, 1418, 1417, 1419, 1417, 1431, 1428, 1446, 1399, 1419, 1420, 1394, 1395, 1408, 1418, 1420, 1451, 1420, 1418, 1420, 1422, 1411, 1415, 1419, 1424, 1418, 1425, 1418, 1418, 1418, 1418, 1418, 1455, 1417, 1420, 1418, 1418, 1419, 1435, 1418, 1424, 1420, 1418, 1455, 1418, 1399, 1417, 1419, 1420, 1418, 1390, 1396, 1417, 1418, 1421, 1405, 1390,
1419, 1412, 1412, 1413, 1417, 1417, 1423, 1442, 1427, 1417, 1419, 1411, 1438, 1419, 1424, 1434, 1419, 1418, 1418, 1413, 1413, 1413, 1419, 1427, 1427, 1424, 1438, 1419, 1418, 1420, 1414, 1418, 1418, 1419, 1458, 1417, 1431, 1418, 1419, 1419, 1420, 1424, 1429, 1430, 1421, 1415, 1414, 1430, 1432, 1430, 1431, 1420, 1462, 1419, 1393, 1408, 1418, 1424, 1422, 1416, 1423, 1419, 1419, 1428, 1420, 1430, 1427, 1420, 1411, 1420, 1421, 1427, 1428, 1424, 1420, 1418, 1420, 1419, 1416, 1410, 1420, 1451, 1416, 1429, 1442, 1427, 1411, 1418, 1459, 1435, 1439, 1436, 1411, 1411, 1419, 1440, 1411, 1416, 1439, 1416, 1418, 1426, 1419, 1425, 1414, 1434, 1415, 1422, 1423, 1424, 1426, 1438, 1426, 1429, 1429, 1418, 1413, 1421, 1410, 1414, 1420, 1425, 1419, 1427, 1422, 1420, 1419, 1432, 1432, 1418, 1416, 1426, 1465, 1467, 1427, 1400, 1407, 1418, 1418, 1412, 1418, 1419, 1403, 1403, 1403, 1425, 1418, 1419, 1418, 1424, 1424, 1397, 1425, 1423, 1417, 1433, 1419, 1425, 1449, 1422, 1436, 1436, 1420, 1420, 1421, 1425, 1420, 1419, 1428, 1418, 1
458, 1427, 1423, 1412, 1414, 1420, 1422, 1419, 1433, 1415, 1410, 1399, 1401, 1455, 1414, 1419, 1436, 1416, 1418, 1421, 1417, 1419, 1418, 1418, 1419, 1418, 1411, 1455, 1414, 1448, 1424, 1418, 1412, 1415, 1415, 1447, 1422, 1434, 1414, 1432, 1396, 1421, 1406, 1418, 1458, 1415, 1390, 1430, 1422, 1418, 1412, 1413, 1419, 1422, 1389, 1419, 1421, 1465, 1419, 1409, 1420, 1427, 1428, 1419, 1419, 1468, 1468, 1413, 1419, 1422, 1419, 1420, 1396, 1418, 1424, 1419, 1419, 1414, 1418, 1424, 1419, 1403, 1412, 1420, 1414.5, 1419, 1408, 1414, 1417, 1420, 1430, 1402, 1417, 1418, 1415, 1418, 1412, 1421, 1417, 1418, 1418, 1416, 1414, 1418, 1422, 1415, 1414, 1420, 1420, 1421, 1422, 1448, 1417, 1418, 1418, 1412, 1416, 1419, 1414, 1427, 1428, 1422, 1424, 1424, 1418, 1415, 1415, 1419, 1418, 1418, 1399, 1421, 1419, 1419, 1421, 1425, 1418, 1425, 1427, 1423, 1418, 1418, 1418, 1418, 1420, 1423, 1419, 1430, 1415, 1417, 1441, 1419, 1420, 1402, 1417, 1419, 1420, 1420, 1420, 1413, 1413, 1418, 1415, 1414, 1431, 1418, 1420, 1420, 1421, 1418, 1
412, 1419, 1458, 1413, 1403, 1420, 1414, 1407, 1430, 1418, 1421, 1427, 1416, 1405, 1395, 1418, 1417, 1418, 1419, 1420, 1417, 1419, 1454, 1421, 1418, 1450, 1414, 1411, 1420, 1422, 1416, 1413, 1418, 1426, 1428, 1418, 1413, 1418, 1421, 1419, 1425, 1425, 1414, 1392, 1419, 1419, 1419, 1421, 1418, 1426, 1415, 1418, 1444, 1426, 1431, 1419, 1406, 1423, 1418, 1434, 1416, 1416, 1421, 1418, 1414, 1418, 1418, 1409, 1409, 1415, 1420, 1417, 1419, 1423, 1417, 1453, 1418, 1420, 1410, 1403, 1421, 1418, 1413, 1398, 1404, 1418, 1418, 1418, 1419, 1418, 1441, 1419, 1426, 1415, 1418, 1419, 1409, 1425, 1418, 1400, 1418, 1414, 1414, 1415, 1415, 1416, 1394, 1425, 1412, 1419, 1413, 1413, 1418, 1418, 1421, 1419, 1412, 1419, 1420, 1418, 1415, 1414, 1431, 1420, 1419, 1406, 1414, 1419, 1419, 1418, 1443, 1424, 1437, 1419, 1416, 1418, 1431, 1442, 1431, 1433, 1418, 1391, 1421, 1420.9, 1419, 1421, 1426, 1422, 1418, 1432, 1437, 1419, 1427, 1415, 1426, 1419, 1420, 1406, 1410, 1411, 1425, 1418, 1418, 1418, 1418, 1417.6, 1413, 1423.3, 1418, 142
1, 1418, 1406, 1417, 1419, 1425, 1418, 1416, 1455, 1414, 1420, 1420, 1424, 1424, 1425, 1418, 1414, 1419, 1418.5, 1425, 1420, 1419, 1428, 1418, 1411, 1419, 1422, 1422, 1417, 1426, 1418, 1419, 1424, 1413, 1418, 1438.8, 1418, 1418, 1418, 1426, 1405, 1416, 1425, 1414, 1414, 1433, 1412, 1415, 1419, 1420, 1418, 1418, 1419, 1419, 1425, 1425, 1428, 1428, 1430, 1406, 1423, 1425, 1418, 1418, 1418, 1418, 1422, 1410, 1420, 1414, 1424, 1404, 1419, 1420, 1418, 1414, 1421, 1384, 1420, 1415, 1418, 1416, 1428, 1431, 1418, 1417, 1408, 1420, 1417, 1454, 1430, 1434, 1422.7, 1438.2, 1422, 1411, 1417, 1419, 1427, 1419, 1425, 1418, 1437, 1418, 1418, 1451, 1419, 1418, 1428, 1419, 1422, 1424, 1420, 1420, 1416, 1428, 1427, 1400, 1419, 1418, 1416.1, 1418.3, 1419, 1457, 1432, 1429, 1423, 1425, 1426, 1437, 1410, 1425.7, 1429, 1422, 1435, 1430, 1435, 1444, 1444, 1468, 1468, 1418, 1421, 1419, 1420, 1420, 1420, 1418, 1419, 1416, 1415, 1423, 1424, 1411, 1418, 1419, 1419, 1433, 1411, 1412, 1416, 1455, 1413, 1419, 1416, 1421)#
#
semi_standard_nonpolar=c(1424, 1421, 1420, 1447, 1418, 1419, 1417, 1414, 1419, 1419, 1403, 1409, 1427, 1420, 1419, 1408, 1412, 1421, 1419, 1419, 1412, 1408, 1409, 1410, 1407, 1410, 1409, 1424, 1409, 1418, 1408, 1405, 1396, 1399, 1424, 1391, 1406, 1419, 1419, 1419, 1420, 1409, 1407, 1428, 1399, 1420, 1391.8, 1404.3, 1417.1, 1408, 1408, 1418, 1426, 1398, 1420, 1417, 1417, 1400, 1423, 1408, 1419, 1400, 1391, 1410, 1400, 1414, 1402.9, 1409, 1418, 1405, 1405, 1420, 1411, 1406, 1410, 1410, 1421, 1415.1, 1418, 1423, 1437, 1418.3, 1420, 1420, 1410, 1410, 1421, 1424, 1419, 1423, 1421, 1420, 1420, 1401, 1430, 1419, 1425, 1420, 1420, 1420, 1420, 1426, 1403, 1435, 1427, 1421, 1397, 1406, 1426, 1426, 1425, 1422, 1400, 1420, 1398, 1431, 1431, 1429, 1429, 1422, 1439, 1440, 1445, 1448, 1448, 1449, 1449, 1450, 1451, 1451, 1453, 1455, 1457, 1459, 1438, 1425, 1427, 1416, 1438, 1414, 1408.7, 1414.8, 1415.3, 1430.2, 1447.9, 1427.5, 1435.06, 1427, 1403, 1414, 1427, 1422, 1428, 1420, 1430, 1432, 1426, 1413, 1428, 1392.14, 1400, 1
407.76, 1412.51, 1419.57, 1426.69, 1433.93, 1441.31, 1449.01, 1456.63, 1464.5, 1417, 1432, 1421, 1423, 1418, 1425, 1423, 1423, 1428, 1425, 1425, 1411, 1428, 1419, 1425, 1420, 1411, 1422, 1428, 1418, 1420, 1422, 1422, 1422, 1412, 1433, 1421, 1420, 1405, 1420, 1408, 1419, 1417, 1420, 1407, 1414, 1422, 1422, 1405, 1414, 1429, 1424, 1428, 1417, 1422, 1422, 1418, 1418, 1425, 1432.6, 1425, 1403, 1426, 1410, 1415, 1403, 1426, 1424, 1420, 1449, 1456, 1424, 1440, 1408, 1411, 1430, 1440, 1426, 1427, 1434, 1442, 1449, 1427, 1434, 1442, 1449, 1440, 1442, 1446, 1446, 1436, 1417.5, 1418, 1422, 1422, 1424, 1424, 1417, 1418, 1421, 1423, 1435, 1426, 1467, 1418, 1420, 1420, 1424, 1438, 1409, 1424, 1422, 1406, 1427, 1418, 1415, 1423, 1419, 1419, 1425, 1426, 1427, 1436, 1425, 1461, 1415, 1414, 1414, 1421, 1424, 1384, 1414, 1414, 1419, 1413, 1419, 1419, 1421, 1424, 1424, 1434, 1414, 1427, 1414, 1421, 1418, 1417, 1400, 1418, 1410, 1410, 1403, 1417, 1423, 1423, 1427, 1414, 1429, 1414, 1417, 1421, 1415, 1420, 1413, 1416, 1423, 142
1, 1421, 1408, 1412, 1424, 1415, 1414, 1413, 1428, 1428, 1429, 1419, 1421, 1412, 1415, 1415, 1404, 1419, 1421, 1408, 1422, 1397, 1430, 1423, 1417, 1418, 1418, 1416, 1423, 1419, 1423, 1422, 1429, 1439, 1414, 1412, 1401, 1412, 1398, 1414, 1420, 1416, 1424, 1429, 1414, 1422, 1414, 1423, 1433, 1435, 1398, 1402, 1418, 1423, 1423, 1418, 1410, 1410, 1419, 1419, 1398, 1430, 1427, 1424, 1418, 1414, 1400, 1423, 1412, 1419, 1421, 1416, 1426, 1416, 1408, 1424, 1419, 1420, 1422, 1422, 1414, 1419, 1418, 1419, 1418, 1409, 1418, 1418, 1398, 1429, 1429, 1415, 1415, 1422, 1415, 1412, 1414, 1420, 1419, 1402, 1429, 1428, 1414, 1414, 1417, 1417, 1423, 1413, 1430, 1455.4, 1391.8, 1420, 1411, 1423, 1405, 1414, 1415, 1419, 1412, 1406, 1421, 1414, 1420, 1423, 1423, 1409, 1413, 1416, 1416, 1415, 1401, 1423, 1430, 1421.7, 1429.4, 1415, 1422, 1414, 1412, 1424, 1408, 1422, 1391, 1423, 1420, 1428, 1428, 1419, 1414, 1423, 1409, 1413, 1411, 1414, 1419, 1400, 1427, 1411, 1419, 1414, 1422, 1417, 1427, 1428, 1420, 1403, 1410, 1415, 1411, 141
1, 1403, 1418, 1394, 1422, 1425, 1425, 1405, 1434, 1409, 1418.5, 1414, 1440, 1418, 1460, 1418, 1398, 1423, 1429, 1416, 1420, 1414, 1420, 1411, 1423, 1431, 1396, 1396, 1397, 1397, 1417, 1422, 1423, 1421, 1418, 1429, 1419, 1401, 1420, 1397, 1401, 1407, 1404, 1414, 1428, 1422, 1432.1, 1420, 1422, 1414, 1424, 1423, 1424, 1417, 1423, 1427, 1415, 1418, 1414, 1405, 1403, 1419, 1419, 1414, 1435, 1421, 1418, 1420, 1423, 1437, 1414, 1414, 1396, 1397, 1437, 1429, 1414, 1420, 1420, 1419, 1419, 1411, 1414, 1433, 1410, 1420, 1408, 1411, 1420, 1422, 1423, 1425, 1419, 1411, 1416, 1417, 1415, 1415, 1416, 1425, 1427, 1406, 1417, 1424, 1424, 1424, 1424, 1415, 1417, 1428, 1429, 1421, 1423, 1423, 1409, 1408, 1409, 1414, 1414, 1415, 1420, 1412, 1422, 1422, 1397.4, 1417.4, 1417.4, 1418, 1418.5, 1414, 1415, 1423, 1415, 1415, 1412, 1414, 1415, 1422, 1422, 1422, 1410, 1452, 1414, 1410, 1413, 1428, 1445, 1410, 1414, 1434, 1435, 1416, 1414, 1413, 1412, 1413, 1413, 1410, 1442, 1450, 1417, 1411, 1414, 1425, 1428)#
#
all_nonpolar=c(standard_nonpolar,semi_standard_nonpolar)#
summary(all_nonpolar)#
sd(all_nonpolar)
histdata = hist(all_nonpolar)#
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
histdata = hist(standard_nonpolar)#
hist(standard_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
histdata = hist(all_nonpolar)#
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
summary(all_nonpolar)#
sd(all_nonpolar)
histdata = hist(all_nonpolar)
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")
abline(v=RI) # draw a vertical line at our RI
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI
text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
#text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI
text(RI+histdata$breaks[2]-histdata$breaks[1], max(histdata$counts), paste("RI =", RI), adj=-1) #n=1670
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophellene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
getwd()
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)#
#
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
library(data.table)#
fread("/Users/peter/Desktop/TOP-2000-2020.txt")
library(data.table)
fread("/Users/peter/Desktop/TOP-2000-2020.txt")
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
all$trt=factor(all$trt)#
male <- all[which (all$sex %in% c("Male")),]#
malep <- male[which (male$odsource %in% c("Plant material")),]#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
#
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]#
#
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))
Relative amount of Beta-caryophyllene in the plant materials#
#
# read data and set factors#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
car$trt=as.factor(car$trt)#
car$trt <- factor(car$trt , levels=c("Unripe pom","Flower pom", "Uncracked pom","Cracked pom","Pistachio"))#
#
Glm <- glm(rel~trt, data=car, family = Gamma)#
Anova(Glm)#
plot(density(Glm$residuals))#
#
p <- glht(Glm, linfct = mcp(trt = "Tukey"))#
summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)##
#
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)#
#
# add significance letters#
  x=c(1:8)  #
  y=c(2.46,1.38, 0.53, 0.47, 0.38)#
  text(x,y, c("a","b","c","c","d"), cex=1.0)
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
all$trt=factor(all$trt)#
male <- all[which (all$sex %in% c("Male")),]#
malep <- male[which (male$odsource %in% c("Plant material")),]#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
#
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]#
#
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))
# Wind tunnel flight responses plot#
# Full colour plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt, #
  color=trt, # colour#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
library(ggplot2)#
library(ggpubr)#
library(mvtnorm)#
library(car)#
library(MASS)#
library(survival)#
library(multcomp)#
library(survminer)#
#
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
all$trt=factor(all$trt)#
male <- all[which (all$sex %in% c("Male")),]#
malep <- male[which (male$odsource %in% c("Plant material")),]#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
#
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]#
#
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))#
#
# Wind tunnel flight responses plot#
# Full colour plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt, #
  color=trt, # colour#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
library(plyr)
library(VGAM)
#
library(ggplot2)
#
library(pscl)
library(VGAM)
library(plyr)
#
library(VGAM)
#
library(ggplot2)
#
library(pscl)
#
library(MASS)
#
library(boot)
#
library(multcomp)
#
library(car)
#
library(ggpubr)
#
library(imager)
#
library(survival)
#
library(ggfortify)
#
library(ranger)
#
library(survminer)
#
library(aod)
# Ovipostion plot#
setwd("//ptx-dc.protix.local/RedirectedFolders/sali/Desktop/BC/Caryophyllene/2019")
#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
# Scatter plot
#
ggplot(Ovi, aes(x=cons, y =tot))+ 
#
  geom_jitter(position=position_jitter(0.08)) +
#
  labs(y="Number of eggs", x="")+ 
#
  theme(text = element_text(size=15))+
#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+
#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+
#
  stat_summary (fun.y=mean, size=1.5, geom="line") +
#
  stat_summary (fun.y=mean, size=4, geom="point")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  facet_grid(.~trt)
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Ovipostion plot#
#
# read data#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
#
# Scatter plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
par(xpd=TRUE)#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot(Ovi, aes(x=cons, y =tot))+ #
  geom_jitter(position=position_jitter(0.08)) +#
  labs(y="Number of eggs", x="")+ #
  theme(text = element_text(size=15))+#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+#
  stat_summary (fun=mean, size=1.0, geom="line") +#
  stat_summary (fun=mean, size=3, geom="point")+#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+#
  facet_grid(.~trt)#
# add significance letters#
  x=c(1:16)  #
  y=c(10.9)#
  x= c(1.13, 1.73, 2.33, 2.95, 3.55, 4.15, 4.75, 5.35,     6.2, 6.8, 7.4, 8.0, 8.65, 9.15, 9.85, 10.45)#
  text(x,y, c("b","b","a","a","a", "b","c","d","BC","AB","AB","A","AB","C", "AB","AB"), cex=1.0)#
#
# add N #
  x= c(0.6, 1.05, 1.63, 2.2, 2.85, 3.45, 4.05, 4.70, 5.30,     6.10, 6.70, 7.30, 7.90, 8.55, 9.05, 9.75, 10.35)#
  y=c(-0.9)#
  text(x,y, c( "N:", "48","10","16","10","21", "9","20","12","48","9","10","8","10","8", "14","6"), cex=1.0)
library(ggplot2)
library(ggpubr)
library(mvtnorm)
library(car)
library(MASS)
library(survival)
library(multcomp)
library(survminer)
# read data and make some convenient subsets#
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
all$trt=factor(all$trt)
male <- all[which (all$sex %in% c("Male")),]
malep <- male[which (male$odsource %in% c("Plant material")),]
malehe <- male[which (male$odsource %in% c("Headspace extract")),]
female <- all[which (all$sex %in% c("Mated female")),]#
femalep <- female[which (female$odsource %in% c("Plant material")),]#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]
vfemale <- all[which (all$sex %in% c("Virgin female")),]#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]
all$odsource_f = factor(all$odsource, levels=c('Plant material','Headspace extract'))
# Wind tunnel flight responses plot#
# Full colour plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt, #
  color=trt, # colour#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
# Wind tunnel flight responses plot#
# Black and white version#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt,#
 color=NULL, # black and white#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
# Relative amount of Beta-caryophyllene in the plant materials#
#
# read data and set factors#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
car$trt=as.factor(car$trt)#
car$trt <- factor(car$trt , levels=c("Unripe pom","Flower pom", "Uncracked pom","Cracked pom","Pistachio"))#
#
Glm <- glm(rel~trt, data=car, family = Gamma)#
Anova(Glm)#
plot(density(Glm$residuals))#
#
p <- glht(Glm, linfct = mcp(trt = "Tukey"))#
summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)#
#
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)#
#
# add significance letters#
  x=c(1:8)  #
  y=c(2.46,1.38, 0.53, 0.47, 0.38)#
  text(x,y, c("a","b","c","c","d"), cex=1.0)
Wind tunnel flight responses plot#
# Black and white version#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot (all, aes (x= reach, y= actual, shape=trt, linetype=trt,#
 color=NULL, # black and white#
)) +#
labs(fill='legend title', color="Odour source",linetype="Odour source", shape="Odour source" ) +#
  stat_summary (fun=mean, size=0.7, geom = "line") +#
  stat_summary (fun=mean, size=3.4, geom = "point")+#
  labs(y="Response proportion", x="Behaviour")+#
  scale_x_discrete(limits=c("Take off","50 cm", "7 cm", "Land"))+#
  facet_grid(odsource_f~sex)+ theme(panel.border = element_blank(), panel.background = element_blank(), panel.grid.major.y = element_line(color = "grey90"))+#
  theme(text = element_text(size=16))+#
  theme(axis.title.y = element_text(margin = margin(t = 0,  r = 20, b = 0, l = 0)))+#
  theme(axis.title.x = element_text(margin = margin(t = 30, r = 0, b = 20, l = 0)))+#
  theme(axis.text.x = element_text(angle = 60, vjust = 0.8, hjust=1))+ #
  theme(legend.justification=c(1,0), legend.position=c(1.3, 0.5))+#
  theme(plot.margin = unit(c(1,6,1,1), "cm"))#
#
# Manual positioning of stars :(#
  x=c(1.45, 2.0, 2.55,  3.9, 3.95,  4.45, 4.5, 4.55, 5.05, 5.0, 5.15, 5.15, 5.65,  6.4, 6.9, 7.5)  #
  y=c(10.3, 9.0, 8.8, 9.9, 10.3, 8.7, 9.1, 9.8, 4.1, 8.5, 9.0, 8.80, 7.5, 5.7, 8.7, 8.7)#
  text(x,y, c("*","*","*","*","**","*","**","***","*","*","***","***","**", "º", "º", "*"), cex=1.2)
# Relative amount of Beta-caryophyllene in the plant materials#
#
# read data and set factors#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
car$trt=as.factor(car$trt)#
car$trt <- factor(car$trt , levels=c("Unripe pom","Flower pom", "Uncracked pom","Cracked pom","Pistachio"))#
#
Glm <- glm(rel~trt, data=car, family = Gamma)#
Anova(Glm)#
plot(density(Glm$residuals))#
#
p <- glht(Glm, linfct = mcp(trt = "Tukey"))#
summary(p)          # standard display#
p.cld <- cld(p)   # letter-based display#
cld(p)#
#
boxplot(rel~trt, data=car, xaxt="n", xlab=NULL,#
ylab=expression(paste(beta, "-caryophellene relative to constant solvent peak @ RI 6.99")),#
las=2, par(mar=c(8,5,2,2)))#
text(cex=1, (x=0.6:4.6), y=-0.15, levels(car$trt), xpd=TRUE, srt=60)#
#
# add significance letters#
  x=c(1:8)  #
  y=c(2.46,1.38, 0.53, 0.47, 0.38)#
  text(x,y, c("a","b","c","c","d"), cex=1.0)#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Ovipostion plot#
#
# read data#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
#
# Scatter plot#
getOption("device")(width = 12, height = 7.5) #fix wndow size for correct positioning#
par(xpd=TRUE)#
plot(1:10, col= "white") #hack to allow plotting over existing ggplot()#
ggplot(Ovi, aes(x=cons, y =tot))+ #
  geom_jitter(position=position_jitter(0.08)) +#
  labs(y="Number of eggs", x="")+ #
  theme(text = element_text(size=15))+#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+#
  stat_summary (fun=mean, size=1.0, geom="line") +#
  stat_summary (fun=mean, size=3, geom="point")+#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+#
  facet_grid(.~trt)#
# add significance letters#
  x=c(1:16)  #
  y=c(10.9)#
  x= c(1.13, 1.73, 2.33, 2.95, 3.55, 4.15, 4.75, 5.35,     6.2, 6.8, 7.4, 8.0, 8.65, 9.15, 9.85, 10.45)#
  text(x,y, c("b","b","a","a","a", "b","c","d","BC","AB","AB","A","AB","C", "AB","AB"), cex=1.0)#
#
# add N #
  x= c(0.6, 1.05, 1.63, 2.2, 2.85, 3.45, 4.05, 4.70, 5.30,     6.10, 6.70, 7.30, 7.90, 8.55, 9.05, 9.75, 10.35)#
  y=c(-0.9)#
  text(x,y, c( "N:", "48","10","16","10","21", "9","20","12","48","9","10","8","10","8", "14","6"), cex=1.0)#
#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#function kovats: Calculate the kovats index, using the linear temperature programming formula (8) taken from#
# Dool,H vand en and Kratz, P.D. (1963) A generalization of the retention index including linear temperature programmed Gas-Liquid#
# partition chromatography. J. Chromatography 11: 463-471.#
#
# I=100*(X-Mn)/(Mn+1 - Mn)+ 100n#
#
# Where X is the rentention time of the peak of interest,Rn and Rnplus1 the  retention times of the alkens eluting directly #
# before and after that peak with n and n+1 the number of carbom atoms in these alkenes#
#
kovats=function(X,Rn, Rnplus1, n) {#
	RI= 100*(X-Rn)/(Rnplus1 - Rn)+ 100*n#
	return (round(RI, 0))#
}#
#
#Results from the experiment:#
X=34.08#
Rn = 32.63#
Rnplus1 = 38.68#
n=14 #compound falls between C14 and C15#
#
RI=kovats(X, Rn, Rnplus1, n)#
RI # #1424,  MS suggest Caryophyllene#
#
# compare this result with known retetion indices for Caryophellene from the literature#
# retrieved from https://pubchem.ncbi.nlm.nih.gov/compound/beta-caryophyllene#section=Kovats-Retention-Index, Oktober 13, 2020#
#Source: NIST Mass Spectrometry Data Center #Record Name: Caryophyllene#
#URL: http://www.nist.gov/srd/nist1a.cfm#
#
standard_nonpolar=c(1423, 1420, 1420, 1419, 1423, 1418, 1421, 1432, 1457, 1419, 1419, 1420, 1427, 1419, 1419, 1423, 1419, 1418, 1411, 1430, 1431, 1415, 1418, 1417, 1420, 1418, 1414, 1416, 1425.6, 1398, 1417, 1418, 1418, 1418, 1418, 1440, 1413, 1413, 1413, 1413, 1413, 1440, 1418, 1457, 1415, 1420, 1467, 1418, 1420, 1419, 1421, 1419, 1417, 1418, 1438, 1418, 1411, 1426, 1467, 1390, 1412, 1430, 1419, 1422, 1414, 1427, 1413, 1419, 1419, 1414, 1417, 1437.2, 1442, 1410, 1423, 1425, 1421, 1420, 1428, 1416, 1420, 1420, 1419, 1420, 1412, 1434, 1418, 1418, 1419, 1417, 1412, 1407, 1404, 1417.6, 1426, 1431.8, 1417, 1416, 1418, 1432, 1435, 1428, 1420, 1419, 1418, 1422, 1420, 1420, 1420, 1419, 1420, 1413, 1417, 1425, 1425, 1418, 1418, 1417, 1425, 1428, 1441, 1406, 1420, 1419, 1420, 1422, 1418, 1424, 1397, 1408, 1427, 1429, 1426, 1430, 1422, 1419, 1419, 1420, 1420, 1419, 1419, 1420, 1418, 1419, 1419, 1419, 1407, 1428, 1420, 1420, 1420, 1420, 1419, 1420, 1418, 1439, 1417, 1418, 1419, 1415, 1420, 1418, 1423, 1415, 1420, 1418
, 1418, 1414, 1418, 1420, 1423, 1421, 1418, 1418, 1419, 1419, 1418, 1404, 1417, 1421, 1418, 1418, 1419, 1420, 1420, 1418, 1418, 1418, 1416, 1418, 1412, 1409, 1410, 1415, 1418, 1416, 1390, 1431, 1418, 1426, 1417, 1416, 1423, 1418, 1411, 1418, 1418, 1418, 1421, 1421, 1414, 1418, 1420, 1419, 1420, 1427, 1418, 1401.3, 1403.15, 1439, 1419, 1423, 1414, 1419, 1425, 1415, 1415, 1414, 1417, 1417, 1417, 1418, 1428, 1418, 1415, 1415, 1404, 1404, 1428, 1418, 1423, 1427, 1420, 1418, 1420, 1400, 1419, 1427, 1440, 1418, 1415, 1417, 1444, 1420, 1422, 1419, 1414, 1451, 1419, 1418, 1423, 1423, 1419, 1420, 1414, 1418, 1451, 1417, 1429.6, 1419, 1427, 1416, 1420, 1419, 1418, 1418, 1409, 1431, 1410, 1418, 1417, 1419, 1417, 1431, 1428, 1446, 1399, 1419, 1420, 1394, 1395, 1408, 1418, 1420, 1451, 1420, 1418, 1420, 1422, 1411, 1415, 1419, 1424, 1418, 1425, 1418, 1418, 1418, 1418, 1418, 1455, 1417, 1420, 1418, 1418, 1419, 1435, 1418, 1424, 1420, 1418, 1455, 1418, 1399, 1417, 1419, 1420, 1418, 1390, 1396, 1417, 1418, 1421, 1405, 1390,
1419, 1412, 1412, 1413, 1417, 1417, 1423, 1442, 1427, 1417, 1419, 1411, 1438, 1419, 1424, 1434, 1419, 1418, 1418, 1413, 1413, 1413, 1419, 1427, 1427, 1424, 1438, 1419, 1418, 1420, 1414, 1418, 1418, 1419, 1458, 1417, 1431, 1418, 1419, 1419, 1420, 1424, 1429, 1430, 1421, 1415, 1414, 1430, 1432, 1430, 1431, 1420, 1462, 1419, 1393, 1408, 1418, 1424, 1422, 1416, 1423, 1419, 1419, 1428, 1420, 1430, 1427, 1420, 1411, 1420, 1421, 1427, 1428, 1424, 1420, 1418, 1420, 1419, 1416, 1410, 1420, 1451, 1416, 1429, 1442, 1427, 1411, 1418, 1459, 1435, 1439, 1436, 1411, 1411, 1419, 1440, 1411, 1416, 1439, 1416, 1418, 1426, 1419, 1425, 1414, 1434, 1415, 1422, 1423, 1424, 1426, 1438, 1426, 1429, 1429, 1418, 1413, 1421, 1410, 1414, 1420, 1425, 1419, 1427, 1422, 1420, 1419, 1432, 1432, 1418, 1416, 1426, 1465, 1467, 1427, 1400, 1407, 1418, 1418, 1412, 1418, 1419, 1403, 1403, 1403, 1425, 1418, 1419, 1418, 1424, 1424, 1397, 1425, 1423, 1417, 1433, 1419, 1425, 1449, 1422, 1436, 1436, 1420, 1420, 1421, 1425, 1420, 1419, 1428, 1418, 1
458, 1427, 1423, 1412, 1414, 1420, 1422, 1419, 1433, 1415, 1410, 1399, 1401, 1455, 1414, 1419, 1436, 1416, 1418, 1421, 1417, 1419, 1418, 1418, 1419, 1418, 1411, 1455, 1414, 1448, 1424, 1418, 1412, 1415, 1415, 1447, 1422, 1434, 1414, 1432, 1396, 1421, 1406, 1418, 1458, 1415, 1390, 1430, 1422, 1418, 1412, 1413, 1419, 1422, 1389, 1419, 1421, 1465, 1419, 1409, 1420, 1427, 1428, 1419, 1419, 1468, 1468, 1413, 1419, 1422, 1419, 1420, 1396, 1418, 1424, 1419, 1419, 1414, 1418, 1424, 1419, 1403, 1412, 1420, 1414.5, 1419, 1408, 1414, 1417, 1420, 1430, 1402, 1417, 1418, 1415, 1418, 1412, 1421, 1417, 1418, 1418, 1416, 1414, 1418, 1422, 1415, 1414, 1420, 1420, 1421, 1422, 1448, 1417, 1418, 1418, 1412, 1416, 1419, 1414, 1427, 1428, 1422, 1424, 1424, 1418, 1415, 1415, 1419, 1418, 1418, 1399, 1421, 1419, 1419, 1421, 1425, 1418, 1425, 1427, 1423, 1418, 1418, 1418, 1418, 1420, 1423, 1419, 1430, 1415, 1417, 1441, 1419, 1420, 1402, 1417, 1419, 1420, 1420, 1420, 1413, 1413, 1418, 1415, 1414, 1431, 1418, 1420, 1420, 1421, 1418, 1
412, 1419, 1458, 1413, 1403, 1420, 1414, 1407, 1430, 1418, 1421, 1427, 1416, 1405, 1395, 1418, 1417, 1418, 1419, 1420, 1417, 1419, 1454, 1421, 1418, 1450, 1414, 1411, 1420, 1422, 1416, 1413, 1418, 1426, 1428, 1418, 1413, 1418, 1421, 1419, 1425, 1425, 1414, 1392, 1419, 1419, 1419, 1421, 1418, 1426, 1415, 1418, 1444, 1426, 1431, 1419, 1406, 1423, 1418, 1434, 1416, 1416, 1421, 1418, 1414, 1418, 1418, 1409, 1409, 1415, 1420, 1417, 1419, 1423, 1417, 1453, 1418, 1420, 1410, 1403, 1421, 1418, 1413, 1398, 1404, 1418, 1418, 1418, 1419, 1418, 1441, 1419, 1426, 1415, 1418, 1419, 1409, 1425, 1418, 1400, 1418, 1414, 1414, 1415, 1415, 1416, 1394, 1425, 1412, 1419, 1413, 1413, 1418, 1418, 1421, 1419, 1412, 1419, 1420, 1418, 1415, 1414, 1431, 1420, 1419, 1406, 1414, 1419, 1419, 1418, 1443, 1424, 1437, 1419, 1416, 1418, 1431, 1442, 1431, 1433, 1418, 1391, 1421, 1420.9, 1419, 1421, 1426, 1422, 1418, 1432, 1437, 1419, 1427, 1415, 1426, 1419, 1420, 1406, 1410, 1411, 1425, 1418, 1418, 1418, 1418, 1417.6, 1413, 1423.3, 1418, 142
1, 1418, 1406, 1417, 1419, 1425, 1418, 1416, 1455, 1414, 1420, 1420, 1424, 1424, 1425, 1418, 1414, 1419, 1418.5, 1425, 1420, 1419, 1428, 1418, 1411, 1419, 1422, 1422, 1417, 1426, 1418, 1419, 1424, 1413, 1418, 1438.8, 1418, 1418, 1418, 1426, 1405, 1416, 1425, 1414, 1414, 1433, 1412, 1415, 1419, 1420, 1418, 1418, 1419, 1419, 1425, 1425, 1428, 1428, 1430, 1406, 1423, 1425, 1418, 1418, 1418, 1418, 1422, 1410, 1420, 1414, 1424, 1404, 1419, 1420, 1418, 1414, 1421, 1384, 1420, 1415, 1418, 1416, 1428, 1431, 1418, 1417, 1408, 1420, 1417, 1454, 1430, 1434, 1422.7, 1438.2, 1422, 1411, 1417, 1419, 1427, 1419, 1425, 1418, 1437, 1418, 1418, 1451, 1419, 1418, 1428, 1419, 1422, 1424, 1420, 1420, 1416, 1428, 1427, 1400, 1419, 1418, 1416.1, 1418.3, 1419, 1457, 1432, 1429, 1423, 1425, 1426, 1437, 1410, 1425.7, 1429, 1422, 1435, 1430, 1435, 1444, 1444, 1468, 1468, 1418, 1421, 1419, 1420, 1420, 1420, 1418, 1419, 1416, 1415, 1423, 1424, 1411, 1418, 1419, 1419, 1433, 1411, 1412, 1416, 1455, 1413, 1419, 1416, 1421)#
#
semi_standard_nonpolar=c(1424, 1421, 1420, 1447, 1418, 1419, 1417, 1414, 1419, 1419, 1403, 1409, 1427, 1420, 1419, 1408, 1412, 1421, 1419, 1419, 1412, 1408, 1409, 1410, 1407, 1410, 1409, 1424, 1409, 1418, 1408, 1405, 1396, 1399, 1424, 1391, 1406, 1419, 1419, 1419, 1420, 1409, 1407, 1428, 1399, 1420, 1391.8, 1404.3, 1417.1, 1408, 1408, 1418, 1426, 1398, 1420, 1417, 1417, 1400, 1423, 1408, 1419, 1400, 1391, 1410, 1400, 1414, 1402.9, 1409, 1418, 1405, 1405, 1420, 1411, 1406, 1410, 1410, 1421, 1415.1, 1418, 1423, 1437, 1418.3, 1420, 1420, 1410, 1410, 1421, 1424, 1419, 1423, 1421, 1420, 1420, 1401, 1430, 1419, 1425, 1420, 1420, 1420, 1420, 1426, 1403, 1435, 1427, 1421, 1397, 1406, 1426, 1426, 1425, 1422, 1400, 1420, 1398, 1431, 1431, 1429, 1429, 1422, 1439, 1440, 1445, 1448, 1448, 1449, 1449, 1450, 1451, 1451, 1453, 1455, 1457, 1459, 1438, 1425, 1427, 1416, 1438, 1414, 1408.7, 1414.8, 1415.3, 1430.2, 1447.9, 1427.5, 1435.06, 1427, 1403, 1414, 1427, 1422, 1428, 1420, 1430, 1432, 1426, 1413, 1428, 1392.14, 1400, 1
407.76, 1412.51, 1419.57, 1426.69, 1433.93, 1441.31, 1449.01, 1456.63, 1464.5, 1417, 1432, 1421, 1423, 1418, 1425, 1423, 1423, 1428, 1425, 1425, 1411, 1428, 1419, 1425, 1420, 1411, 1422, 1428, 1418, 1420, 1422, 1422, 1422, 1412, 1433, 1421, 1420, 1405, 1420, 1408, 1419, 1417, 1420, 1407, 1414, 1422, 1422, 1405, 1414, 1429, 1424, 1428, 1417, 1422, 1422, 1418, 1418, 1425, 1432.6, 1425, 1403, 1426, 1410, 1415, 1403, 1426, 1424, 1420, 1449, 1456, 1424, 1440, 1408, 1411, 1430, 1440, 1426, 1427, 1434, 1442, 1449, 1427, 1434, 1442, 1449, 1440, 1442, 1446, 1446, 1436, 1417.5, 1418, 1422, 1422, 1424, 1424, 1417, 1418, 1421, 1423, 1435, 1426, 1467, 1418, 1420, 1420, 1424, 1438, 1409, 1424, 1422, 1406, 1427, 1418, 1415, 1423, 1419, 1419, 1425, 1426, 1427, 1436, 1425, 1461, 1415, 1414, 1414, 1421, 1424, 1384, 1414, 1414, 1419, 1413, 1419, 1419, 1421, 1424, 1424, 1434, 1414, 1427, 1414, 1421, 1418, 1417, 1400, 1418, 1410, 1410, 1403, 1417, 1423, 1423, 1427, 1414, 1429, 1414, 1417, 1421, 1415, 1420, 1413, 1416, 1423, 142
1, 1421, 1408, 1412, 1424, 1415, 1414, 1413, 1428, 1428, 1429, 1419, 1421, 1412, 1415, 1415, 1404, 1419, 1421, 1408, 1422, 1397, 1430, 1423, 1417, 1418, 1418, 1416, 1423, 1419, 1423, 1422, 1429, 1439, 1414, 1412, 1401, 1412, 1398, 1414, 1420, 1416, 1424, 1429, 1414, 1422, 1414, 1423, 1433, 1435, 1398, 1402, 1418, 1423, 1423, 1418, 1410, 1410, 1419, 1419, 1398, 1430, 1427, 1424, 1418, 1414, 1400, 1423, 1412, 1419, 1421, 1416, 1426, 1416, 1408, 1424, 1419, 1420, 1422, 1422, 1414, 1419, 1418, 1419, 1418, 1409, 1418, 1418, 1398, 1429, 1429, 1415, 1415, 1422, 1415, 1412, 1414, 1420, 1419, 1402, 1429, 1428, 1414, 1414, 1417, 1417, 1423, 1413, 1430, 1455.4, 1391.8, 1420, 1411, 1423, 1405, 1414, 1415, 1419, 1412, 1406, 1421, 1414, 1420, 1423, 1423, 1409, 1413, 1416, 1416, 1415, 1401, 1423, 1430, 1421.7, 1429.4, 1415, 1422, 1414, 1412, 1424, 1408, 1422, 1391, 1423, 1420, 1428, 1428, 1419, 1414, 1423, 1409, 1413, 1411, 1414, 1419, 1400, 1427, 1411, 1419, 1414, 1422, 1417, 1427, 1428, 1420, 1403, 1410, 1415, 1411, 141
1, 1403, 1418, 1394, 1422, 1425, 1425, 1405, 1434, 1409, 1418.5, 1414, 1440, 1418, 1460, 1418, 1398, 1423, 1429, 1416, 1420, 1414, 1420, 1411, 1423, 1431, 1396, 1396, 1397, 1397, 1417, 1422, 1423, 1421, 1418, 1429, 1419, 1401, 1420, 1397, 1401, 1407, 1404, 1414, 1428, 1422, 1432.1, 1420, 1422, 1414, 1424, 1423, 1424, 1417, 1423, 1427, 1415, 1418, 1414, 1405, 1403, 1419, 1419, 1414, 1435, 1421, 1418, 1420, 1423, 1437, 1414, 1414, 1396, 1397, 1437, 1429, 1414, 1420, 1420, 1419, 1419, 1411, 1414, 1433, 1410, 1420, 1408, 1411, 1420, 1422, 1423, 1425, 1419, 1411, 1416, 1417, 1415, 1415, 1416, 1425, 1427, 1406, 1417, 1424, 1424, 1424, 1424, 1415, 1417, 1428, 1429, 1421, 1423, 1423, 1409, 1408, 1409, 1414, 1414, 1415, 1420, 1412, 1422, 1422, 1397.4, 1417.4, 1417.4, 1418, 1418.5, 1414, 1415, 1423, 1415, 1415, 1412, 1414, 1415, 1422, 1422, 1422, 1410, 1452, 1414, 1410, 1413, 1428, 1445, 1410, 1414, 1434, 1435, 1416, 1414, 1413, 1412, 1413, 1413, 1410, 1442, 1450, 1417, 1411, 1414, 1425, 1428)
all_nonpolar=c(standard_nonpolar,semi_standard_nonpolar)#
summary(all_nonpolar)#
sd(all_nonpolar)#
#
hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophyllene")#
histdata=hist(all_nonpolar, main="", xlab="Kovats rentention indices for Caryophyllene")#
abline(v=RI) # draw a vertical line at our RI#
text(histdata$breaks[2], max(histdata$counts), paste("n=", length(all_nonpolar))) #n=1670#
text(RI, max(histdata$counts), paste("RI =", RI), adj=-0.10) #n=1670
library(plyr)
#
library(VGAM)
#
library(ggplot2)
#
library(pscl)
#
library(MASS)
#
library(boot)
#
library(multcomp)
#
library(car)
#
library(ggpubr)
#
library(imager)
#
library(survival)
#
library(ggfortify)
#
library(ranger)
#
library(survminer)
#
library(aod)
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
male <- all[which (all$sex %in% c("Male")),]
#
malep <- male[which (male$odsource %in% c("Plant material")),]
#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
female <- all[which (all$sex %in% c("Mated female")),]
#
femalep <- female[which (female$odsource %in% c("Plant material")),]
#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]
#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]
#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]
# Logestic regression#
# Male plant#
# Take off
#
malepT <- malep[which (malep$reachl %in% c("Take off")),]
#
mod1 <- glm(actual ~ trt, data = malepT, family = "binomial")
#
Anova(mod1)
#
summary (glht(mod1, linfct=mcp(trt="Dunnett")))
# 50 cm
#
malep50 <- malep[which (malep$reachl %in% c("50 cm")),]
#
mod2 <- glm(actual ~ trt, data = malep50, family = "binomial")
#
Anova(mod2)
#
summary (glht(mod2, linfct=mcp(trt="Dunnett")))
# 7 cm
#
malep7 <- malep[which (malep$reachl %in% c("7 cm")),]
#
mod3 <- glm(actual ~ trt, data = malep7, family = "binomial")
#
Anova(mod3)
#
summary (glht(mod3, linfct=mcp(trt="Dunnett")))#
# Land#
malepL <- malep[which (malep$reachl %in% c("Land")),]
#
mod4 <- glm (actual ~ trt, data = malepL, family = "binomial")
#
Anova(mod4)
#
summary (glht(mod4, linfct=mcp(trt="Dunnett")))
-------------------------------------------------------------------------
#
# Male Headspace#
# Take off
#
maleheT <- malehe[which (malehe$reachl %in% c("Take off")),]
#
mod5 <- glm(actual ~ trt, data = maleheT, family = "binomial")
#
Anova(mod5)
#
summary (glht(mod5, linfct=mcp(trt="Dunnett")))
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
male <- all[which (all$sex %in% c("Male")),]
#
malep <- male[which (male$odsource %in% c("Plant material")),]
#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
female <- all[which (all$sex %in% c("Mated female")),]
#
femalep <- female[which (female$odsource %in% c("Plant material")),]
#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]
#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]
#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]
# Take off
#
malepT <- malep[which (malep$reachl %in% c("Take off")),]
mod1 <- glm(actual ~ trt, data = malepT, family = "binomial")
Anova(mod1)
mod1new=glht(mod1, linfct=mcp(trt="Dunnett"))
summary(mod1)
# 50 cm
#
malep50 <- malep[which (malep$reachl %in% c("50 cm")),]
#
mod2 <- glm(actual ~ trt, data = malep50, family = "binomial")
#
Anova(mod2)
# 7 cm
#
malep7 <- malep[which (malep$reachl %in% c("7 cm")),]
#
mod3 <- glm(actual ~ trt, data = malep7, family = "binomial")
#
Anova(mod3)
malepL <- malep[which (malep$reachl %in% c("Land")),]
#
mod4 <- glm (actual ~ trt, data = malepL, family = "binomial")
#
Anova(mod4)
# Take off
#
maleheT <- malehe[which (malehe$reachl %in% c("Take off")),]
#
mod5 <- glm(actual ~ trt, data = maleheT, family = "binomial")
#
Anova(mod5)
# 50 cm
#
malehe50 <- malehe[which (malehe$reachl %in% c("50 cm")),]
#
mod6 <- glm(actual ~ trt, data = malehe50, family = "binomial")
#
Anova(mod6)
# 7 cm
#
malehe7 <- malehe[which (malehe$reachl %in% c("7 cm")),]
#
mod7 <- glm(actual ~ trt, data = malehe7, family = "binomial")
#
Anova(mod7)
maleheL <- malehe[which (malehe$reachl %in% c("Land")),]
#
mod8 <- glm (actual ~ trt, data = maleheL, family = "binomial")
#
Anova(mod8)
# Take off
#
femalepT <- femalep[which (femalep$reachl %in% c("Take off")),]
#
mod9 <- glm(actual ~ trt, data = femalepT, family = "binomial")
#
Anova(mod9)
# 50 cm
#
femalep50 <- femalep[which (femalep$reachl %in% c("50 cm")),]
#
mod10 <- glm(actual ~ trt, data = femalep50, family = "binomial")
#
Anova(mod10)
# 7 cm
#
femalep7 <- femalep[which (femalep$reachl %in% c("7 cm")),]
#
mod11 <- glm(actual ~ trt, data = femalep7, family = "binomial")
#
Anova(mod11)
# Land
#
femalepL <- femalep[which (femalep$reachl %in% c("Land")),]
#
mod12 <- glm (actual ~ trt, data = femalepL, family = "binomial")
#
plot(density(mod12$residuals))
#
Anova(mod12)
# Take off
#
femaleheT <- femalehe[which (femalehe$reachl %in% c("Take off")),]
#
mod13 <- glm(actual ~ trt, data = femaleheT, family = "binomial")
#
Anova(mod13)
# 50 cm
#
femalehe50 <- femalehe[which (femalehe$reachl %in% c("50 cm")),]
#
mod14 <- glm(actual ~ trt, data = femalehe50, family = "binomial")
#
Anova(mod14)
# 7 cm
#
femalehe7 <- femalehe[which (femalehe$reachl %in% c("7 cm")),]
#
mod15 <- glm(actual ~ trt, data = femalehe7, family = "binomial")
#
Anova(mod15)
femaleheL <- femalehe[which (femalehe$reachl %in% c("Land")),]
#
mod16 <- glm (actual ~ trt, data = femaleheL, family = "binomial")
#
Anova(mod16)
# Take off
#
vfemalepT <- vfemalep[which (vfemalep$reachl %in% c("Take off")),]
#
mod17 <- glm(actual ~ trt, data = vfemalepT, family = "binomial")
#
Anova(mod17)
# 50 cm
#
vfemalep50 <- vfemalep[which (vfemalep$reachl %in% c("50 cm")),]
#
mod18 <- glm(actual ~ trt, data = vfemalep50, family = "binomial")
#
Anova(mod18)
# 7 cm
#
vfemalep7 <- vfemalep[which (vfemalep$reachl %in% c("7 cm")),]
#
mod19 <- glm(actual ~ trt, data = vfemalep7, family = "binomial")
#
Anova(mod19)
# Land
#
vfemalepL <- vfemalep[which (vfemalep$reachl %in% c("Land")),]
#
mod20 <- glm (actual ~ trt, data = vfemalepL, family = "binomial")
#
Anova(mod20)
# Take off
#
vfemaleheT <- vfemalehe[which (vfemalehe$reachl %in% c("Take off")),]
#
mod21 <- glm(actual ~ trt, data = vfemaleheT, family = "binomial")
#
Anova(mod21)
# 50 cm
#
vfemalehe50 <- vfemalehe[which (vfemalehe$reachl %in% c("50 cm")),]
#
mod22 <- glm(actual ~ trt, data = vfemalehe50, family = "binomial")
#
Anova(mod22)
# 7 cm
#
vfemalehe7 <- vfemalehe[which (vfemalehe$reachl %in% c("7 cm")),]
#
mod23 <- glm(actual ~ trt, data = vfemalehe7, family = "binomial")
#
Anova(mod23)
# Land#
vfemaleheL <- vfemalehe[which (vfemalehe$reachl %in% c("Land")),]
#
mod24 <- glm (actual ~ trt, data = vfemaleheL, family = "binomial")
#
Anova(mod24)
# Kaplan_Meier 
#
# Male Plant  #
  # Pistachio
#
malepp<-malep[which(malep$trt %in% c("Pistachio","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepp)
ggsurvplot(km_fit, data = malepp, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom
#
malepcp<-malep[which(malep$trt %in% c("Cracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepcp)
#
ggsurvplot(km_fit, data = malepcp, pval = TRUE, xlab="", ylab= "Reached")
# Uncracked pom
#
malepup<-malep[which(malep$trt %in% c("Uncracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepup)
#
ggsurvplot(km_fit, data = malepup, pval = TRUE, xlab="", ylab= "Reached")
#Unripe pom 
#
malepurp<-malep[which(malep$trt %in% c("Unripe pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepurp)
#
ggsurvplot(km_fit, data = malepurp, pval = TRUE, xlab="", ylab= "Reached")#
#Flower pom 
#
malepf<-malep[which(malep$trt %in% c("Flower pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malepf)
#
ggsurvplot(km_fit, data = malepf, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
# Male Headspace extract  #
# Pistachio HE
#
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehep)
#
ggsurvplot(km_fit, data = malehep, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
# Male Headspace extract  #
# Pistachio HE
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]
# Cracked pom HE
#
malehecp<-malehe[which(malehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehecp)
#
ggsurvplot(km_fit, data = malehecp, pval = TRUE, xlab="", ylab= "Reached")
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]
#
k
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehep)
malehep
ggsurvplot(km_fit, data = malehep, pval = TRUE, xlab="", ylab= "Reached")
# Male Headspace extract  #
# Pistachio HE
#
malehep<-malehe[which(malehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehep)
#
ggsurvplot(km_fit, data = malehep, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom HE
#
malehecp<-malehe[which(malehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=malehecp)
#
ggsurvplot(km_fit, data = malehecp, pval = TRUE, xlab="", ylab= "Reached")
# Mated female Plant  #
  # Pistachio
#
femalepp<-femalep[which(femalep$trt %in% c("Pistachio","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepp)
#
ggsurvplot(km_fit, data = femalepp, pval = TRUE, xlab="", ylab= "Reached")
# Pistachio
#
femalepp<-femalep[which(femalep$trt %in% c("Pistachio","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepp)
#
ggsurvplot(km_fit, data = femalepp, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom
#
femalepcp<-femalep[which(femalep$trt %in% c("Cracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepcp)
#
ggsurvplot(km_fit, data = femalepcp, pval = TRUE, xlab="", ylab= "Reached")
# Uncracked pom
#
femalepup<-femalep[which(femalep$trt %in% c("Uncracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepup)
#
ggsurvplot(km_fit, data = femalepup, pval = TRUE, xlab="", ylab= "Reached")
#Unripe pom 
#
femalepurp<-femalep[which(femalep$trt %in% c("Unripe pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepurp)
#
ggsurvplot(km_fit, data = femalepurp, pval = TRUE, xlab="", ylab= "Reached")
#Flower pom 
#
femalepf<-femalep[which(femalep$trt %in% c("Flower pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepf)
#
ggsurvplot(km_fit, data = femalepf, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
  # Mated female Headspace extract  #
  # Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")#
# Cracked pom HE
#
femalehecp<-femalehe[which(femalehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehecp)
#
ggsurvplot(km_fit, data = femalehecp, pval = TRUE, xlab="", ylab= "Reached")
# Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
# Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom HE
#
femalehecp<-femalehe[which(femalehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehecp)
#
ggsurvplot(km_fit, data = femalehecp, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
  # Mated female Headspace extract  #
  # Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")#
# Cracked pom HE
#
femalehecp<-femalehe[which(femalehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehecp)
#
ggsurvplot(km_fit, data = femalehecp, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
  # Mated female Headspace extract  #
  # Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
#Flower pom 
#
femalepf<-femalep[which(femalep$trt %in% c("Flower pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalepf)
#
ggsurvplot(km_fit, data = femalepf, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
  # Mated female Headspace extract
# Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
femalehe$trt %in% c("Pistachio HE","Blank")
which(femalehe$trt %in% c("Pistachio HE","Blank"))
femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
-------------------------------------
#
  # Mated female Headspace extract  #
  # Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
# Pistachio HE
#
  femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
# Pistachio HE
#
femalehep<-femalehe[which(femalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehep)
#
ggsurvplot(km_fit, data = femalehep, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom HE
#
femalehecp<-femalehe[which(femalehe$trt %in% c("Cracked pom HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=femalehecp)
#
ggsurvplot(km_fit, data = femalehecp, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom
#
vfemalepcp<-vfemalep[which(vfemalep$trt %in% c("Cracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepcp)
#
ggsurvplot(km_fit, data = vfemalepcp, pval = TRUE, xlab="", ylab= "Reached")
# Uncracked pom
#
vfemalepup<-vfemalep[which(vfemalep$trt %in% c("Uncracked pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepup)
#
ggsurvplot(km_fit, data = vfemalepup, pval = TRUE, xlab="", ylab= "Reached")
#Unripe pom 
#
vfemalepurp<-vfemalep[which(vfemalep$trt %in% c("Unripe pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepurp)
#
ggsurvplot(km_fit, data = vfemalepurp, pval = TRUE, xlab="", ylab= "Reached")
#Flower pom 
#
vfemalepf<-vfemalep[which(vfemalep$trt %in% c("Flower pom","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalepf)
#
ggsurvplot(km_fit, data = vfemalepf, pval = TRUE, xlab="", ylab= "Reached")
-------------------------------------
#
  # vfemale Headspace extract  #
  # Pistachio HE
#
vfemalehep<-vfemalehe[which(vfemalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehep)
#
ggsurvplot(km_fit, data = vfemalehep, pval = TRUE, xlab="", ylab= "Reached")
vfemalehep<-vfemalehe[which(vfemalehe$trt %in% c("Pistachio HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehep)
ggsurvplot(km_fit, data = vfemalehep, pval = TRUE, xlab="", ylab= "Reached")
vfemalehep<-vfemalehe[which(vfemalehe$trt %in% c("Pistachio HE","Blank")),]
#
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehep)
#
ggsurvplot(km_fit, data = vfemalehep, pval = TRUE, xlab="", ylab= "Reached")
# Cracked pom HE
#
vfemalehecp<-vfemalehe[which(vfemalehe$trt %in% c("Cracked pom HE","Blank")),]
km_fit <- survfit(Surv(rch, stat) ~ trt, data=vfemalehecp)
ggsurvplot(km_fit, data = vfemalehecp, pval = TRUE, xlab="", ylab= "Reached")
# Relative amount of Beta-caryophyllene in the plant materials#
setwd("//ptx-dc.protix.local/RedirectedFolders/sali/Desktop/BC/Caryophyllene/2019")
#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
Glm <- glm(rel~trt, data=car, family = Gamma)
#
Anova(Glm)
#
plot(density(Glm$residuals))
# Relative amount of Beta-caryophyllene in the plant materials#
#setwd("//ptx-dc.protix.local/RedirectedFolders/sali/Desktop/BC/Caryophyllene/2019")
#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
Glm <- glm(rel~trt, data=car, family = Gamma)
#
Anova(Glm)
#
plot(density(Glm$residuals))
#  AIC(Glm2)
#
# 1 - pchisq(summary(Glm2)$deviance, summary(Glm2)$df.residual)
#
# # # OK!
#
# plot(density(Glm2$residuals))
p <- glht(Glm, linfct = mcp(trt = "Tukey"))
#
# summary(p)          # standard display
#
p.cld <- cld(p)   # letter-based display
#
cld(p)
ggplot(car, aes(x=trt, y=rel))+ geom_boxplot()+
#
  labs(y="Relative amount of ??-caryophyllene \n to the constant peak (retention time: 6.99)", x="Plant materials")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  theme(axis.title.x = element_text(margin = margin(t = 20, r = 0, b = 0, l = 0)))+
#
  theme(panel.grid.major.y = element_line(color = "grey90"), panel.background = element_rect(fill = "white", colour = "grey50"))+
#
  scale_x_discrete(limits=c("Flower pom", "Unripe pom", "Uncracked pom", "Cracked pom", "Pistachio"))+
#
  scale_y_continuous(breaks=c(0, 0.5, 1, 1.5, 2, 2.5, 3))+
#
  theme(text = element_text(size=15))
plot(1:10)
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
# Scatter plot
#
ggplot(Ovi, aes(x=cons, y =tot))+ 
#
  geom_jitter(position=position_jitter(0.08)) +
#
  labs(y="Number of eggs", x="")+ 
#
  theme(text = element_text(size=15))+
#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+
#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+
#
  stat_summary (fun.y=mean, size=1.5, geom="line") +
#
  stat_summary (fun.y=mean, size=4, geom="point")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  facet_grid(.~trt)
caryo <- Ovi [which (Ovi$trt %in% c("Hexane (control)", "Beta-caryophyllene")),]
cis3 <- Ovi [which (Ovi$trt %in% c("Hexane (control)", "Cis-3-hexen-1-ol")),]
modc <- glm(data=caryo, tot~consl+date , family = poisson) 
#
densityPlot(modc$residuals)
#
Anova (modc)
#
summary (glht(modc, linfct=mcp(consl="Dunnett")))
modc <- glm(data=caryo, tot~consl+date , family = poisson) 
#
densityPlot(modc$residuals)
#
Anova (modc)
p <- glht(modc, linfct = mcp(consl = "Tukey"))
#
# summary(p)          # standard display
#
p.cld <- cld(p)   # letter-based display
p <- glht(modc, linfct = mcp(consl = "Tukey"))
p.cld <- cld(p)   # letter-based display
#
cld(p)
p <- glht(modc, linfct = mcp(consl = "Tukey"))
p
modcis <- glm(data=cis3, tot~consl + date, family = poisson) 
#
Anova (modcis)
#
densityPlot(modcis$residuals)
#
summary (glht(modcis, linfct=mcp(consl="Dunnett")))
modcis <- glm(data=cis3, tot~consl + date, family = poisson) 
#
Anova (modcis)
#
densityPlot(modcis$residuals)
p <- glht(modcis, linfct = mcp(consl = "Tukey"))
#
# summary(p)          # standard display
#
p.cld <- cld(p)   # letter-based display
cld(p)
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)
# Ovipostion plot#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
# Scatter plot
#
ggplot(Ovi, aes(x=cons, y =tot))+ 
#
  geom_jitter(position=position_jitter(0.08)) +
#
  labs(y="Number of eggs", x="")+ 
#
  theme(text = element_text(size=15))+
#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+
#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+
#
  stat_summary (fun.y=mean, size=1.5, geom="line") +
#
  stat_summary (fun.y=mean, size=4, geom="point")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  facet_grid(.~trt)
library(ggplot2)
# Ovipostion plot#
Ovi <- read.csv("OV.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
# Scatter plot
#
ggplot(Ovi, aes(x=cons, y =tot))+ 
#
  geom_jitter(position=position_jitter(0.08)) +
#
  labs(y="Number of eggs", x="")+ 
#
  theme(text = element_text(size=15))+
#
  theme(panel.background = element_blank(), panel.grid.major = element_line(color = "grey90"))+
#
  scale_x_discrete(limits=c("0 ng", "10 ng", "40 ng", "80 ng", "100 ng", "160 ng", "200 ng", "400 ng"))+
#
  stat_summary (fun.y=mean, size=1.5, geom="line") +
#
  stat_summary (fun.y=mean, size=4, geom="point")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  facet_grid(.~trt)
# Relative amount of Beta-caryophyllene in the plant materials#
car <- read.csv("Ccaryo.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
Glm <- glm(rel~trt, data=car, family = Gamma)
#
Anova(Glm)
#
plot(density(Glm$residuals))#
#  AIC(Glm2)
#
# 1 - pchisq(summary(Glm2)$deviance, summary(Glm2)$df.residual)
#
# # # OK!
#
# plot(density(Glm2$residuals))#
p <- glht(Glm, linfct = mcp(trt = "Tukey"))
#
# summary(p)          # standard display
#
p.cld <- cld(p)   # letter-based display
#
cld(p)
ggplot(car, aes(x=trt, y=rel))+ geom_boxplot()+
#
  labs(y="Relative amount of ??-caryophyllene \n to the constant peak (retention time: 6.99)", x="Plant materials")+
#
  theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))+
#
  theme(axis.title.x = element_text(margin = margin(t = 20, r = 0, b = 0, l = 0)))+
#
  theme(panel.grid.major.y = element_line(color = "grey90"), panel.background = element_rect(fill = "white", colour = "grey50"))+
#
  scale_x_discrete(limits=c("Flower pom", "Unripe pom", "Uncracked pom", "Cracked pom", "Pistachio"))+
#
  scale_y_continuous(breaks=c(0, 0.5, 1, 1.5, 2, 2.5, 3))+
#
  theme(text = element_text(size=15))
# Pistachio
#
malepp<-malep[which(malep$trt %in% c("Pistachio","Blank")),]
library(plyr)
#
library(VGAM)
#
library(ggplot2)
#
library(pscl)
#
library(MASS)
#
library(boot)
#
library(multcomp)
#
library(car)
#
library(ggpubr)
#
library(imager)
#
library(survival)
#
library(ggfortify)
#
library(ranger)
#
library(survminer)
#
library(aod)
library(plyr)
#
library(VGAM)
#
library(ggplot2)
#
library(pscl)
#
library(MASS)
#
library(boot)
#
library(multcomp)
#
library(car)
#
library(ggpubr)
#
library(imager)
#
library(survival)
#
library(ggfortify)
#
library(ranger)
#
library(survminer)
#
library(aod)
all <- read.csv("all.csv", header = TRUE, sep = ",", dec = ".", fill = TRUE)#
male <- all[which (all$sex %in% c("Male")),]
#
malep <- male[which (male$odsource %in% c("Plant material")),]
#
malehe <- male[which (male$odsource %in% c("Headspace extract")),]#
female <- all[which (all$sex %in% c("Mated female")),]
#
femalep <- female[which (female$odsource %in% c("Plant material")),]
#
femalehe <- female[which (female$odsource %in% c("Headspace extract")),]#
vfemale <- all[which (all$sex %in% c("Virgin female")),]
#
vfemalep <- vfemale[which (vfemale$odsource %in% c("Plant material")),]
#
vfemalehe <- vfemale[which (vfemale$odsource %in% c("Headspace extract")),]
# Logestic regression
#
# Male plant#
# Take off
#
malepT <- malep[which (malep$reachl %in% c("Take off")),]
#
mod1 <- glm(actual ~ trt, data = malepT, family = "binomial")
#
Anova(mod1)
summary (glht(mod1, linfct=mcp(trt="Dunnett")))
library(multcomp)
summary(mod1)
Anova(mod1)
